
bin/kernel:     file format elf64-littleriscv


Disassembly of section .text:

ffffffffc0200000 <kern_entry>:

    .section .text,"ax",%progbits
    .globl kern_entry
kern_entry:
    # t0 := 三级页表的虚拟地址
    lui     t0, %hi(boot_page_table_sv39)
ffffffffc0200000:	c02062b7          	lui	t0,0xc0206
    # t1 := 0xffffffff40000000 即虚实映射偏移量
    li      t1, 0xffffffffc0000000 - 0x80000000
ffffffffc0200004:	ffd0031b          	addiw	t1,zero,-3
ffffffffc0200008:	037a                	slli	t1,t1,0x1e
    # t0 减去虚实映射偏移量 0xffffffff40000000，变为三级页表的物理地址
    sub     t0, t0, t1
ffffffffc020000a:	406282b3          	sub	t0,t0,t1
    # t0 >>= 12，变为三级页表的物理页号
    srli    t0, t0, 12
ffffffffc020000e:	00c2d293          	srli	t0,t0,0xc

    # t1 := 8 << 60，设置 satp 的 MODE 字段为 Sv39
    li      t1, 8 << 60
ffffffffc0200012:	fff0031b          	addiw	t1,zero,-1
ffffffffc0200016:	137e                	slli	t1,t1,0x3f
    # 将刚才计算出的预设三级页表物理页号附加到 satp 中
    or      t0, t0, t1
ffffffffc0200018:	0062e2b3          	or	t0,t0,t1
    # 将算出的 t0(即新的MODE|页表基址物理页号) 覆盖到 satp 中
    csrw    satp, t0
ffffffffc020001c:	18029073          	csrw	satp,t0
    # 使用 sfence.vma 指令刷新 TLB
    sfence.vma
ffffffffc0200020:	12000073          	sfence.vma
    # 从此，我们给内核搭建出了一个完美的虚拟内存空间！
    #nop # 可能映射的位置有些bug。。插入一个nop
    
    # 我们在虚拟内存空间中：随意将 sp 设置为虚拟地址！
    lui sp, %hi(bootstacktop)
ffffffffc0200024:	c0206137          	lui	sp,0xc0206

    # 我们在虚拟内存空间中：随意跳转到虚拟地址！
    # 跳转到 kern_init
    lui t0, %hi(kern_init)
ffffffffc0200028:	c02002b7          	lui	t0,0xc0200
    addi t0, t0, %lo(kern_init)
ffffffffc020002c:	03228293          	addi	t0,t0,50 # ffffffffc0200032 <kern_init>
    jr t0
ffffffffc0200030:	8282                	jr	t0

ffffffffc0200032 <kern_init>:
void grade_backtrace(void);


int kern_init(void) {
    extern char edata[], end[];
    memset(edata, 0, end - edata);
ffffffffc0200032:	00007517          	auipc	a0,0x7
ffffffffc0200036:	fde50513          	addi	a0,a0,-34 # ffffffffc0207010 <buddy_zone>
ffffffffc020003a:	00007617          	auipc	a2,0x7
ffffffffc020003e:	57660613          	addi	a2,a2,1398 # ffffffffc02075b0 <end>
int kern_init(void) {
ffffffffc0200042:	1141                	addi	sp,sp,-16
    memset(edata, 0, end - edata);
ffffffffc0200044:	8e09                	sub	a2,a2,a0
ffffffffc0200046:	4581                	li	a1,0
int kern_init(void) {
ffffffffc0200048:	e406                	sd	ra,8(sp)
    memset(edata, 0, end - edata);
ffffffffc020004a:	3de020ef          	jal	ra,ffffffffc0202428 <memset>
    cons_init();  // init the console
ffffffffc020004e:	3fc000ef          	jal	ra,ffffffffc020044a <cons_init>
    const char *message = "(THU.CST) os is loading ...\0";
    //cprintf("%s\n\n", message);
    cputs(message);
ffffffffc0200052:	00002517          	auipc	a0,0x2
ffffffffc0200056:	3ee50513          	addi	a0,a0,1006 # ffffffffc0202440 <etext+0x6>
ffffffffc020005a:	090000ef          	jal	ra,ffffffffc02000ea <cputs>

    print_kerninfo();
ffffffffc020005e:	0dc000ef          	jal	ra,ffffffffc020013a <print_kerninfo>

    // grade_backtrace();
    idt_init();  // init interrupt descriptor table
ffffffffc0200062:	402000ef          	jal	ra,ffffffffc0200464 <idt_init>

    pmm_init();  // init physical memory management
ffffffffc0200066:	210010ef          	jal	ra,ffffffffc0201276 <pmm_init>

    idt_init();  // init interrupt descriptor table
ffffffffc020006a:	3fa000ef          	jal	ra,ffffffffc0200464 <idt_init>

    clock_init();   // init clock interrupt
ffffffffc020006e:	39a000ef          	jal	ra,ffffffffc0200408 <clock_init>
    intr_enable();  // enable irq interrupt
ffffffffc0200072:	3e6000ef          	jal	ra,ffffffffc0200458 <intr_enable>



    /* do nothing */
    while (1)
ffffffffc0200076:	a001                	j	ffffffffc0200076 <kern_init+0x44>

ffffffffc0200078 <cputch>:
ffffffffc0200078:	1141                	addi	sp,sp,-16
ffffffffc020007a:	e022                	sd	s0,0(sp)
ffffffffc020007c:	e406                	sd	ra,8(sp)
ffffffffc020007e:	842e                	mv	s0,a1
ffffffffc0200080:	3cc000ef          	jal	ra,ffffffffc020044c <cons_putc>
ffffffffc0200084:	401c                	lw	a5,0(s0)
ffffffffc0200086:	60a2                	ld	ra,8(sp)
ffffffffc0200088:	2785                	addiw	a5,a5,1
ffffffffc020008a:	c01c                	sw	a5,0(s0)
ffffffffc020008c:	6402                	ld	s0,0(sp)
ffffffffc020008e:	0141                	addi	sp,sp,16
ffffffffc0200090:	8082                	ret

ffffffffc0200092 <vcprintf>:
ffffffffc0200092:	1101                	addi	sp,sp,-32
ffffffffc0200094:	862a                	mv	a2,a0
ffffffffc0200096:	86ae                	mv	a3,a1
ffffffffc0200098:	00000517          	auipc	a0,0x0
ffffffffc020009c:	fe050513          	addi	a0,a0,-32 # ffffffffc0200078 <cputch>
ffffffffc02000a0:	006c                	addi	a1,sp,12
ffffffffc02000a2:	ec06                	sd	ra,24(sp)
ffffffffc02000a4:	c602                	sw	zero,12(sp)
ffffffffc02000a6:	6ad010ef          	jal	ra,ffffffffc0201f52 <vprintfmt>
ffffffffc02000aa:	60e2                	ld	ra,24(sp)
ffffffffc02000ac:	4532                	lw	a0,12(sp)
ffffffffc02000ae:	6105                	addi	sp,sp,32
ffffffffc02000b0:	8082                	ret

ffffffffc02000b2 <cprintf>:
ffffffffc02000b2:	711d                	addi	sp,sp,-96
ffffffffc02000b4:	02810313          	addi	t1,sp,40 # ffffffffc0206028 <boot_page_table_sv39+0x28>
ffffffffc02000b8:	8e2a                	mv	t3,a0
ffffffffc02000ba:	f42e                	sd	a1,40(sp)
ffffffffc02000bc:	f832                	sd	a2,48(sp)
ffffffffc02000be:	fc36                	sd	a3,56(sp)
ffffffffc02000c0:	00000517          	auipc	a0,0x0
ffffffffc02000c4:	fb850513          	addi	a0,a0,-72 # ffffffffc0200078 <cputch>
ffffffffc02000c8:	004c                	addi	a1,sp,4
ffffffffc02000ca:	869a                	mv	a3,t1
ffffffffc02000cc:	8672                	mv	a2,t3
ffffffffc02000ce:	ec06                	sd	ra,24(sp)
ffffffffc02000d0:	e0ba                	sd	a4,64(sp)
ffffffffc02000d2:	e4be                	sd	a5,72(sp)
ffffffffc02000d4:	e8c2                	sd	a6,80(sp)
ffffffffc02000d6:	ecc6                	sd	a7,88(sp)
ffffffffc02000d8:	e41a                	sd	t1,8(sp)
ffffffffc02000da:	c202                	sw	zero,4(sp)
ffffffffc02000dc:	677010ef          	jal	ra,ffffffffc0201f52 <vprintfmt>
ffffffffc02000e0:	60e2                	ld	ra,24(sp)
ffffffffc02000e2:	4512                	lw	a0,4(sp)
ffffffffc02000e4:	6125                	addi	sp,sp,96
ffffffffc02000e6:	8082                	ret

ffffffffc02000e8 <cputchar>:
ffffffffc02000e8:	a695                	j	ffffffffc020044c <cons_putc>

ffffffffc02000ea <cputs>:
ffffffffc02000ea:	1101                	addi	sp,sp,-32
ffffffffc02000ec:	e822                	sd	s0,16(sp)
ffffffffc02000ee:	ec06                	sd	ra,24(sp)
ffffffffc02000f0:	e426                	sd	s1,8(sp)
ffffffffc02000f2:	842a                	mv	s0,a0
ffffffffc02000f4:	00054503          	lbu	a0,0(a0)
ffffffffc02000f8:	c51d                	beqz	a0,ffffffffc0200126 <cputs+0x3c>
ffffffffc02000fa:	0405                	addi	s0,s0,1
ffffffffc02000fc:	4485                	li	s1,1
ffffffffc02000fe:	9c81                	subw	s1,s1,s0
ffffffffc0200100:	34c000ef          	jal	ra,ffffffffc020044c <cons_putc>
ffffffffc0200104:	00044503          	lbu	a0,0(s0)
ffffffffc0200108:	008487bb          	addw	a5,s1,s0
ffffffffc020010c:	0405                	addi	s0,s0,1
ffffffffc020010e:	f96d                	bnez	a0,ffffffffc0200100 <cputs+0x16>
ffffffffc0200110:	0017841b          	addiw	s0,a5,1
ffffffffc0200114:	4529                	li	a0,10
ffffffffc0200116:	336000ef          	jal	ra,ffffffffc020044c <cons_putc>
ffffffffc020011a:	60e2                	ld	ra,24(sp)
ffffffffc020011c:	8522                	mv	a0,s0
ffffffffc020011e:	6442                	ld	s0,16(sp)
ffffffffc0200120:	64a2                	ld	s1,8(sp)
ffffffffc0200122:	6105                	addi	sp,sp,32
ffffffffc0200124:	8082                	ret
ffffffffc0200126:	4405                	li	s0,1
ffffffffc0200128:	b7f5                	j	ffffffffc0200114 <cputs+0x2a>

ffffffffc020012a <getchar>:
ffffffffc020012a:	1141                	addi	sp,sp,-16
ffffffffc020012c:	e406                	sd	ra,8(sp)
ffffffffc020012e:	326000ef          	jal	ra,ffffffffc0200454 <cons_getc>
ffffffffc0200132:	dd75                	beqz	a0,ffffffffc020012e <getchar+0x4>
ffffffffc0200134:	60a2                	ld	ra,8(sp)
ffffffffc0200136:	0141                	addi	sp,sp,16
ffffffffc0200138:	8082                	ret

ffffffffc020013a <print_kerninfo>:
ffffffffc020013a:	1141                	addi	sp,sp,-16
ffffffffc020013c:	00002517          	auipc	a0,0x2
ffffffffc0200140:	32450513          	addi	a0,a0,804 # ffffffffc0202460 <etext+0x26>
ffffffffc0200144:	e406                	sd	ra,8(sp)
ffffffffc0200146:	f6dff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc020014a:	00000597          	auipc	a1,0x0
ffffffffc020014e:	ee858593          	addi	a1,a1,-280 # ffffffffc0200032 <kern_init>
ffffffffc0200152:	00002517          	auipc	a0,0x2
ffffffffc0200156:	32e50513          	addi	a0,a0,814 # ffffffffc0202480 <etext+0x46>
ffffffffc020015a:	f59ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc020015e:	00002597          	auipc	a1,0x2
ffffffffc0200162:	2dc58593          	addi	a1,a1,732 # ffffffffc020243a <etext>
ffffffffc0200166:	00002517          	auipc	a0,0x2
ffffffffc020016a:	33a50513          	addi	a0,a0,826 # ffffffffc02024a0 <etext+0x66>
ffffffffc020016e:	f45ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0200172:	00007597          	auipc	a1,0x7
ffffffffc0200176:	e9e58593          	addi	a1,a1,-354 # ffffffffc0207010 <buddy_zone>
ffffffffc020017a:	00002517          	auipc	a0,0x2
ffffffffc020017e:	34650513          	addi	a0,a0,838 # ffffffffc02024c0 <etext+0x86>
ffffffffc0200182:	f31ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0200186:	00007597          	auipc	a1,0x7
ffffffffc020018a:	42a58593          	addi	a1,a1,1066 # ffffffffc02075b0 <end>
ffffffffc020018e:	00002517          	auipc	a0,0x2
ffffffffc0200192:	35250513          	addi	a0,a0,850 # ffffffffc02024e0 <etext+0xa6>
ffffffffc0200196:	f1dff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc020019a:	00008597          	auipc	a1,0x8
ffffffffc020019e:	81558593          	addi	a1,a1,-2027 # ffffffffc02079af <end+0x3ff>
ffffffffc02001a2:	00000797          	auipc	a5,0x0
ffffffffc02001a6:	e9078793          	addi	a5,a5,-368 # ffffffffc0200032 <kern_init>
ffffffffc02001aa:	40f587b3          	sub	a5,a1,a5
ffffffffc02001ae:	43f7d593          	srai	a1,a5,0x3f
ffffffffc02001b2:	60a2                	ld	ra,8(sp)
ffffffffc02001b4:	3ff5f593          	andi	a1,a1,1023
ffffffffc02001b8:	95be                	add	a1,a1,a5
ffffffffc02001ba:	85a9                	srai	a1,a1,0xa
ffffffffc02001bc:	00002517          	auipc	a0,0x2
ffffffffc02001c0:	34450513          	addi	a0,a0,836 # ffffffffc0202500 <etext+0xc6>
ffffffffc02001c4:	0141                	addi	sp,sp,16
ffffffffc02001c6:	b5f5                	j	ffffffffc02000b2 <cprintf>

ffffffffc02001c8 <print_stackframe>:
ffffffffc02001c8:	1141                	addi	sp,sp,-16
ffffffffc02001ca:	00002617          	auipc	a2,0x2
ffffffffc02001ce:	36660613          	addi	a2,a2,870 # ffffffffc0202530 <etext+0xf6>
ffffffffc02001d2:	04e00593          	li	a1,78
ffffffffc02001d6:	00002517          	auipc	a0,0x2
ffffffffc02001da:	37250513          	addi	a0,a0,882 # ffffffffc0202548 <etext+0x10e>
ffffffffc02001de:	e406                	sd	ra,8(sp)
ffffffffc02001e0:	1cc000ef          	jal	ra,ffffffffc02003ac <__panic>

ffffffffc02001e4 <mon_help>:
ffffffffc02001e4:	1141                	addi	sp,sp,-16
ffffffffc02001e6:	00002617          	auipc	a2,0x2
ffffffffc02001ea:	37a60613          	addi	a2,a2,890 # ffffffffc0202560 <etext+0x126>
ffffffffc02001ee:	00002597          	auipc	a1,0x2
ffffffffc02001f2:	39258593          	addi	a1,a1,914 # ffffffffc0202580 <etext+0x146>
ffffffffc02001f6:	00002517          	auipc	a0,0x2
ffffffffc02001fa:	39250513          	addi	a0,a0,914 # ffffffffc0202588 <etext+0x14e>
ffffffffc02001fe:	e406                	sd	ra,8(sp)
ffffffffc0200200:	eb3ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0200204:	00002617          	auipc	a2,0x2
ffffffffc0200208:	39460613          	addi	a2,a2,916 # ffffffffc0202598 <etext+0x15e>
ffffffffc020020c:	00002597          	auipc	a1,0x2
ffffffffc0200210:	3b458593          	addi	a1,a1,948 # ffffffffc02025c0 <etext+0x186>
ffffffffc0200214:	00002517          	auipc	a0,0x2
ffffffffc0200218:	37450513          	addi	a0,a0,884 # ffffffffc0202588 <etext+0x14e>
ffffffffc020021c:	e97ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0200220:	00002617          	auipc	a2,0x2
ffffffffc0200224:	3b060613          	addi	a2,a2,944 # ffffffffc02025d0 <etext+0x196>
ffffffffc0200228:	00002597          	auipc	a1,0x2
ffffffffc020022c:	3c858593          	addi	a1,a1,968 # ffffffffc02025f0 <etext+0x1b6>
ffffffffc0200230:	00002517          	auipc	a0,0x2
ffffffffc0200234:	35850513          	addi	a0,a0,856 # ffffffffc0202588 <etext+0x14e>
ffffffffc0200238:	e7bff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc020023c:	60a2                	ld	ra,8(sp)
ffffffffc020023e:	4501                	li	a0,0
ffffffffc0200240:	0141                	addi	sp,sp,16
ffffffffc0200242:	8082                	ret

ffffffffc0200244 <mon_kerninfo>:
ffffffffc0200244:	1141                	addi	sp,sp,-16
ffffffffc0200246:	e406                	sd	ra,8(sp)
ffffffffc0200248:	ef3ff0ef          	jal	ra,ffffffffc020013a <print_kerninfo>
ffffffffc020024c:	60a2                	ld	ra,8(sp)
ffffffffc020024e:	4501                	li	a0,0
ffffffffc0200250:	0141                	addi	sp,sp,16
ffffffffc0200252:	8082                	ret

ffffffffc0200254 <mon_backtrace>:
ffffffffc0200254:	1141                	addi	sp,sp,-16
ffffffffc0200256:	e406                	sd	ra,8(sp)
ffffffffc0200258:	f71ff0ef          	jal	ra,ffffffffc02001c8 <print_stackframe>
ffffffffc020025c:	60a2                	ld	ra,8(sp)
ffffffffc020025e:	4501                	li	a0,0
ffffffffc0200260:	0141                	addi	sp,sp,16
ffffffffc0200262:	8082                	ret

ffffffffc0200264 <kmonitor>:
ffffffffc0200264:	7115                	addi	sp,sp,-224
ffffffffc0200266:	ed5e                	sd	s7,152(sp)
ffffffffc0200268:	8baa                	mv	s7,a0
ffffffffc020026a:	00002517          	auipc	a0,0x2
ffffffffc020026e:	39650513          	addi	a0,a0,918 # ffffffffc0202600 <etext+0x1c6>
ffffffffc0200272:	ed86                	sd	ra,216(sp)
ffffffffc0200274:	e9a2                	sd	s0,208(sp)
ffffffffc0200276:	e5a6                	sd	s1,200(sp)
ffffffffc0200278:	e1ca                	sd	s2,192(sp)
ffffffffc020027a:	fd4e                	sd	s3,184(sp)
ffffffffc020027c:	f952                	sd	s4,176(sp)
ffffffffc020027e:	f556                	sd	s5,168(sp)
ffffffffc0200280:	f15a                	sd	s6,160(sp)
ffffffffc0200282:	e962                	sd	s8,144(sp)
ffffffffc0200284:	e566                	sd	s9,136(sp)
ffffffffc0200286:	e16a                	sd	s10,128(sp)
ffffffffc0200288:	e2bff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc020028c:	00002517          	auipc	a0,0x2
ffffffffc0200290:	39c50513          	addi	a0,a0,924 # ffffffffc0202628 <etext+0x1ee>
ffffffffc0200294:	e1fff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0200298:	000b8563          	beqz	s7,ffffffffc02002a2 <kmonitor+0x3e>
ffffffffc020029c:	855e                	mv	a0,s7
ffffffffc020029e:	3a4000ef          	jal	ra,ffffffffc0200642 <print_trapframe>
ffffffffc02002a2:	00002c17          	auipc	s8,0x2
ffffffffc02002a6:	3f6c0c13          	addi	s8,s8,1014 # ffffffffc0202698 <commands>
ffffffffc02002aa:	00002917          	auipc	s2,0x2
ffffffffc02002ae:	3a690913          	addi	s2,s2,934 # ffffffffc0202650 <etext+0x216>
ffffffffc02002b2:	00002497          	auipc	s1,0x2
ffffffffc02002b6:	3a648493          	addi	s1,s1,934 # ffffffffc0202658 <etext+0x21e>
ffffffffc02002ba:	49bd                	li	s3,15
ffffffffc02002bc:	00002b17          	auipc	s6,0x2
ffffffffc02002c0:	3a4b0b13          	addi	s6,s6,932 # ffffffffc0202660 <etext+0x226>
ffffffffc02002c4:	00002a17          	auipc	s4,0x2
ffffffffc02002c8:	2bca0a13          	addi	s4,s4,700 # ffffffffc0202580 <etext+0x146>
ffffffffc02002cc:	4a8d                	li	s5,3
ffffffffc02002ce:	854a                	mv	a0,s2
ffffffffc02002d0:	004020ef          	jal	ra,ffffffffc02022d4 <readline>
ffffffffc02002d4:	842a                	mv	s0,a0
ffffffffc02002d6:	dd65                	beqz	a0,ffffffffc02002ce <kmonitor+0x6a>
ffffffffc02002d8:	00054583          	lbu	a1,0(a0)
ffffffffc02002dc:	4c81                	li	s9,0
ffffffffc02002de:	e1bd                	bnez	a1,ffffffffc0200344 <kmonitor+0xe0>
ffffffffc02002e0:	fe0c87e3          	beqz	s9,ffffffffc02002ce <kmonitor+0x6a>
ffffffffc02002e4:	6582                	ld	a1,0(sp)
ffffffffc02002e6:	00002d17          	auipc	s10,0x2
ffffffffc02002ea:	3b2d0d13          	addi	s10,s10,946 # ffffffffc0202698 <commands>
ffffffffc02002ee:	8552                	mv	a0,s4
ffffffffc02002f0:	4401                	li	s0,0
ffffffffc02002f2:	0d61                	addi	s10,s10,24
ffffffffc02002f4:	100020ef          	jal	ra,ffffffffc02023f4 <strcmp>
ffffffffc02002f8:	c919                	beqz	a0,ffffffffc020030e <kmonitor+0xaa>
ffffffffc02002fa:	2405                	addiw	s0,s0,1
ffffffffc02002fc:	0b540063          	beq	s0,s5,ffffffffc020039c <kmonitor+0x138>
ffffffffc0200300:	000d3503          	ld	a0,0(s10)
ffffffffc0200304:	6582                	ld	a1,0(sp)
ffffffffc0200306:	0d61                	addi	s10,s10,24
ffffffffc0200308:	0ec020ef          	jal	ra,ffffffffc02023f4 <strcmp>
ffffffffc020030c:	f57d                	bnez	a0,ffffffffc02002fa <kmonitor+0x96>
ffffffffc020030e:	00141793          	slli	a5,s0,0x1
ffffffffc0200312:	97a2                	add	a5,a5,s0
ffffffffc0200314:	078e                	slli	a5,a5,0x3
ffffffffc0200316:	97e2                	add	a5,a5,s8
ffffffffc0200318:	6b9c                	ld	a5,16(a5)
ffffffffc020031a:	865e                	mv	a2,s7
ffffffffc020031c:	002c                	addi	a1,sp,8
ffffffffc020031e:	fffc851b          	addiw	a0,s9,-1
ffffffffc0200322:	9782                	jalr	a5
ffffffffc0200324:	fa0555e3          	bgez	a0,ffffffffc02002ce <kmonitor+0x6a>
ffffffffc0200328:	60ee                	ld	ra,216(sp)
ffffffffc020032a:	644e                	ld	s0,208(sp)
ffffffffc020032c:	64ae                	ld	s1,200(sp)
ffffffffc020032e:	690e                	ld	s2,192(sp)
ffffffffc0200330:	79ea                	ld	s3,184(sp)
ffffffffc0200332:	7a4a                	ld	s4,176(sp)
ffffffffc0200334:	7aaa                	ld	s5,168(sp)
ffffffffc0200336:	7b0a                	ld	s6,160(sp)
ffffffffc0200338:	6bea                	ld	s7,152(sp)
ffffffffc020033a:	6c4a                	ld	s8,144(sp)
ffffffffc020033c:	6caa                	ld	s9,136(sp)
ffffffffc020033e:	6d0a                	ld	s10,128(sp)
ffffffffc0200340:	612d                	addi	sp,sp,224
ffffffffc0200342:	8082                	ret
ffffffffc0200344:	8526                	mv	a0,s1
ffffffffc0200346:	0cc020ef          	jal	ra,ffffffffc0202412 <strchr>
ffffffffc020034a:	c901                	beqz	a0,ffffffffc020035a <kmonitor+0xf6>
ffffffffc020034c:	00144583          	lbu	a1,1(s0)
ffffffffc0200350:	00040023          	sb	zero,0(s0)
ffffffffc0200354:	0405                	addi	s0,s0,1
ffffffffc0200356:	d5c9                	beqz	a1,ffffffffc02002e0 <kmonitor+0x7c>
ffffffffc0200358:	b7f5                	j	ffffffffc0200344 <kmonitor+0xe0>
ffffffffc020035a:	00044783          	lbu	a5,0(s0)
ffffffffc020035e:	d3c9                	beqz	a5,ffffffffc02002e0 <kmonitor+0x7c>
ffffffffc0200360:	033c8963          	beq	s9,s3,ffffffffc0200392 <kmonitor+0x12e>
ffffffffc0200364:	003c9793          	slli	a5,s9,0x3
ffffffffc0200368:	0118                	addi	a4,sp,128
ffffffffc020036a:	97ba                	add	a5,a5,a4
ffffffffc020036c:	f887b023          	sd	s0,-128(a5)
ffffffffc0200370:	00044583          	lbu	a1,0(s0)
ffffffffc0200374:	2c85                	addiw	s9,s9,1
ffffffffc0200376:	e591                	bnez	a1,ffffffffc0200382 <kmonitor+0x11e>
ffffffffc0200378:	b7b5                	j	ffffffffc02002e4 <kmonitor+0x80>
ffffffffc020037a:	00144583          	lbu	a1,1(s0)
ffffffffc020037e:	0405                	addi	s0,s0,1
ffffffffc0200380:	d1a5                	beqz	a1,ffffffffc02002e0 <kmonitor+0x7c>
ffffffffc0200382:	8526                	mv	a0,s1
ffffffffc0200384:	08e020ef          	jal	ra,ffffffffc0202412 <strchr>
ffffffffc0200388:	d96d                	beqz	a0,ffffffffc020037a <kmonitor+0x116>
ffffffffc020038a:	00044583          	lbu	a1,0(s0)
ffffffffc020038e:	d9a9                	beqz	a1,ffffffffc02002e0 <kmonitor+0x7c>
ffffffffc0200390:	bf55                	j	ffffffffc0200344 <kmonitor+0xe0>
ffffffffc0200392:	45c1                	li	a1,16
ffffffffc0200394:	855a                	mv	a0,s6
ffffffffc0200396:	d1dff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc020039a:	b7e9                	j	ffffffffc0200364 <kmonitor+0x100>
ffffffffc020039c:	6582                	ld	a1,0(sp)
ffffffffc020039e:	00002517          	auipc	a0,0x2
ffffffffc02003a2:	2e250513          	addi	a0,a0,738 # ffffffffc0202680 <etext+0x246>
ffffffffc02003a6:	d0dff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc02003aa:	b715                	j	ffffffffc02002ce <kmonitor+0x6a>

ffffffffc02003ac <__panic>:
ffffffffc02003ac:	00007317          	auipc	t1,0x7
ffffffffc02003b0:	1bc30313          	addi	t1,t1,444 # ffffffffc0207568 <is_panic>
ffffffffc02003b4:	00032e03          	lw	t3,0(t1)
ffffffffc02003b8:	715d                	addi	sp,sp,-80
ffffffffc02003ba:	ec06                	sd	ra,24(sp)
ffffffffc02003bc:	e822                	sd	s0,16(sp)
ffffffffc02003be:	f436                	sd	a3,40(sp)
ffffffffc02003c0:	f83a                	sd	a4,48(sp)
ffffffffc02003c2:	fc3e                	sd	a5,56(sp)
ffffffffc02003c4:	e0c2                	sd	a6,64(sp)
ffffffffc02003c6:	e4c6                	sd	a7,72(sp)
ffffffffc02003c8:	020e1a63          	bnez	t3,ffffffffc02003fc <__panic+0x50>
ffffffffc02003cc:	4785                	li	a5,1
ffffffffc02003ce:	00f32023          	sw	a5,0(t1)
ffffffffc02003d2:	8432                	mv	s0,a2
ffffffffc02003d4:	103c                	addi	a5,sp,40
ffffffffc02003d6:	862e                	mv	a2,a1
ffffffffc02003d8:	85aa                	mv	a1,a0
ffffffffc02003da:	00002517          	auipc	a0,0x2
ffffffffc02003de:	30650513          	addi	a0,a0,774 # ffffffffc02026e0 <commands+0x48>
ffffffffc02003e2:	e43e                	sd	a5,8(sp)
ffffffffc02003e4:	ccfff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc02003e8:	65a2                	ld	a1,8(sp)
ffffffffc02003ea:	8522                	mv	a0,s0
ffffffffc02003ec:	ca7ff0ef          	jal	ra,ffffffffc0200092 <vcprintf>
ffffffffc02003f0:	00003517          	auipc	a0,0x3
ffffffffc02003f4:	12050513          	addi	a0,a0,288 # ffffffffc0203510 <buddy_pmm_manager+0x4f0>
ffffffffc02003f8:	cbbff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc02003fc:	062000ef          	jal	ra,ffffffffc020045e <intr_disable>
ffffffffc0200400:	4501                	li	a0,0
ffffffffc0200402:	e63ff0ef          	jal	ra,ffffffffc0200264 <kmonitor>
ffffffffc0200406:	bfed                	j	ffffffffc0200400 <__panic+0x54>

ffffffffc0200408 <clock_init>:
ffffffffc0200408:	1141                	addi	sp,sp,-16
ffffffffc020040a:	e406                	sd	ra,8(sp)
ffffffffc020040c:	02000793          	li	a5,32
ffffffffc0200410:	1047a7f3          	csrrs	a5,sie,a5
ffffffffc0200414:	c0102573          	rdtime	a0
ffffffffc0200418:	67e1                	lui	a5,0x18
ffffffffc020041a:	6a078793          	addi	a5,a5,1696 # 186a0 <kern_entry-0xffffffffc01e7960>
ffffffffc020041e:	953e                	add	a0,a0,a5
ffffffffc0200420:	783010ef          	jal	ra,ffffffffc02023a2 <sbi_set_timer>
ffffffffc0200424:	60a2                	ld	ra,8(sp)
ffffffffc0200426:	00007797          	auipc	a5,0x7
ffffffffc020042a:	1407b523          	sd	zero,330(a5) # ffffffffc0207570 <ticks>
ffffffffc020042e:	00002517          	auipc	a0,0x2
ffffffffc0200432:	2d250513          	addi	a0,a0,722 # ffffffffc0202700 <commands+0x68>
ffffffffc0200436:	0141                	addi	sp,sp,16
ffffffffc0200438:	b9ad                	j	ffffffffc02000b2 <cprintf>

ffffffffc020043a <clock_set_next_event>:
ffffffffc020043a:	c0102573          	rdtime	a0
ffffffffc020043e:	67e1                	lui	a5,0x18
ffffffffc0200440:	6a078793          	addi	a5,a5,1696 # 186a0 <kern_entry-0xffffffffc01e7960>
ffffffffc0200444:	953e                	add	a0,a0,a5
ffffffffc0200446:	75d0106f          	j	ffffffffc02023a2 <sbi_set_timer>

ffffffffc020044a <cons_init>:
ffffffffc020044a:	8082                	ret

ffffffffc020044c <cons_putc>:
ffffffffc020044c:	0ff57513          	andi	a0,a0,255
ffffffffc0200450:	7390106f          	j	ffffffffc0202388 <sbi_console_putchar>

ffffffffc0200454 <cons_getc>:
ffffffffc0200454:	7690106f          	j	ffffffffc02023bc <sbi_console_getchar>

ffffffffc0200458 <intr_enable>:
ffffffffc0200458:	100167f3          	csrrsi	a5,sstatus,2
ffffffffc020045c:	8082                	ret

ffffffffc020045e <intr_disable>:
ffffffffc020045e:	100177f3          	csrrci	a5,sstatus,2
ffffffffc0200462:	8082                	ret

ffffffffc0200464 <idt_init>:
     */

    extern void __alltraps(void);
    /* Set sup0 scratch register to 0, indicating to exception vector
       that we are presently executing in the kernel */
    write_csr(sscratch, 0);
ffffffffc0200464:	14005073          	csrwi	sscratch,0
    /* Set the exception vector address */
    write_csr(stvec, &__alltraps);
ffffffffc0200468:	00000797          	auipc	a5,0x0
ffffffffc020046c:	2e478793          	addi	a5,a5,740 # ffffffffc020074c <__alltraps>
ffffffffc0200470:	10579073          	csrw	stvec,a5
}
ffffffffc0200474:	8082                	ret

ffffffffc0200476 <print_regs>:
    cprintf("  badvaddr 0x%08x\n", tf->badvaddr);
    cprintf("  cause    0x%08x\n", tf->cause);
}

void print_regs(struct pushregs *gpr) {
    cprintf("  zero     0x%08x\n", gpr->zero);
ffffffffc0200476:	610c                	ld	a1,0(a0)
void print_regs(struct pushregs *gpr) {
ffffffffc0200478:	1141                	addi	sp,sp,-16
ffffffffc020047a:	e022                	sd	s0,0(sp)
ffffffffc020047c:	842a                	mv	s0,a0
    cprintf("  zero     0x%08x\n", gpr->zero);
ffffffffc020047e:	00002517          	auipc	a0,0x2
ffffffffc0200482:	2a250513          	addi	a0,a0,674 # ffffffffc0202720 <commands+0x88>
void print_regs(struct pushregs *gpr) {
ffffffffc0200486:	e406                	sd	ra,8(sp)
    cprintf("  zero     0x%08x\n", gpr->zero);
ffffffffc0200488:	c2bff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  ra       0x%08x\n", gpr->ra);
ffffffffc020048c:	640c                	ld	a1,8(s0)
ffffffffc020048e:	00002517          	auipc	a0,0x2
ffffffffc0200492:	2aa50513          	addi	a0,a0,682 # ffffffffc0202738 <commands+0xa0>
ffffffffc0200496:	c1dff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  sp       0x%08x\n", gpr->sp);
ffffffffc020049a:	680c                	ld	a1,16(s0)
ffffffffc020049c:	00002517          	auipc	a0,0x2
ffffffffc02004a0:	2b450513          	addi	a0,a0,692 # ffffffffc0202750 <commands+0xb8>
ffffffffc02004a4:	c0fff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  gp       0x%08x\n", gpr->gp);
ffffffffc02004a8:	6c0c                	ld	a1,24(s0)
ffffffffc02004aa:	00002517          	auipc	a0,0x2
ffffffffc02004ae:	2be50513          	addi	a0,a0,702 # ffffffffc0202768 <commands+0xd0>
ffffffffc02004b2:	c01ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  tp       0x%08x\n", gpr->tp);
ffffffffc02004b6:	700c                	ld	a1,32(s0)
ffffffffc02004b8:	00002517          	auipc	a0,0x2
ffffffffc02004bc:	2c850513          	addi	a0,a0,712 # ffffffffc0202780 <commands+0xe8>
ffffffffc02004c0:	bf3ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  t0       0x%08x\n", gpr->t0);
ffffffffc02004c4:	740c                	ld	a1,40(s0)
ffffffffc02004c6:	00002517          	auipc	a0,0x2
ffffffffc02004ca:	2d250513          	addi	a0,a0,722 # ffffffffc0202798 <commands+0x100>
ffffffffc02004ce:	be5ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  t1       0x%08x\n", gpr->t1);
ffffffffc02004d2:	780c                	ld	a1,48(s0)
ffffffffc02004d4:	00002517          	auipc	a0,0x2
ffffffffc02004d8:	2dc50513          	addi	a0,a0,732 # ffffffffc02027b0 <commands+0x118>
ffffffffc02004dc:	bd7ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  t2       0x%08x\n", gpr->t2);
ffffffffc02004e0:	7c0c                	ld	a1,56(s0)
ffffffffc02004e2:	00002517          	auipc	a0,0x2
ffffffffc02004e6:	2e650513          	addi	a0,a0,742 # ffffffffc02027c8 <commands+0x130>
ffffffffc02004ea:	bc9ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  s0       0x%08x\n", gpr->s0);
ffffffffc02004ee:	602c                	ld	a1,64(s0)
ffffffffc02004f0:	00002517          	auipc	a0,0x2
ffffffffc02004f4:	2f050513          	addi	a0,a0,752 # ffffffffc02027e0 <commands+0x148>
ffffffffc02004f8:	bbbff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  s1       0x%08x\n", gpr->s1);
ffffffffc02004fc:	642c                	ld	a1,72(s0)
ffffffffc02004fe:	00002517          	auipc	a0,0x2
ffffffffc0200502:	2fa50513          	addi	a0,a0,762 # ffffffffc02027f8 <commands+0x160>
ffffffffc0200506:	badff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  a0       0x%08x\n", gpr->a0);
ffffffffc020050a:	682c                	ld	a1,80(s0)
ffffffffc020050c:	00002517          	auipc	a0,0x2
ffffffffc0200510:	30450513          	addi	a0,a0,772 # ffffffffc0202810 <commands+0x178>
ffffffffc0200514:	b9fff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  a1       0x%08x\n", gpr->a1);
ffffffffc0200518:	6c2c                	ld	a1,88(s0)
ffffffffc020051a:	00002517          	auipc	a0,0x2
ffffffffc020051e:	30e50513          	addi	a0,a0,782 # ffffffffc0202828 <commands+0x190>
ffffffffc0200522:	b91ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  a2       0x%08x\n", gpr->a2);
ffffffffc0200526:	702c                	ld	a1,96(s0)
ffffffffc0200528:	00002517          	auipc	a0,0x2
ffffffffc020052c:	31850513          	addi	a0,a0,792 # ffffffffc0202840 <commands+0x1a8>
ffffffffc0200530:	b83ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  a3       0x%08x\n", gpr->a3);
ffffffffc0200534:	742c                	ld	a1,104(s0)
ffffffffc0200536:	00002517          	auipc	a0,0x2
ffffffffc020053a:	32250513          	addi	a0,a0,802 # ffffffffc0202858 <commands+0x1c0>
ffffffffc020053e:	b75ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  a4       0x%08x\n", gpr->a4);
ffffffffc0200542:	782c                	ld	a1,112(s0)
ffffffffc0200544:	00002517          	auipc	a0,0x2
ffffffffc0200548:	32c50513          	addi	a0,a0,812 # ffffffffc0202870 <commands+0x1d8>
ffffffffc020054c:	b67ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  a5       0x%08x\n", gpr->a5);
ffffffffc0200550:	7c2c                	ld	a1,120(s0)
ffffffffc0200552:	00002517          	auipc	a0,0x2
ffffffffc0200556:	33650513          	addi	a0,a0,822 # ffffffffc0202888 <commands+0x1f0>
ffffffffc020055a:	b59ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  a6       0x%08x\n", gpr->a6);
ffffffffc020055e:	604c                	ld	a1,128(s0)
ffffffffc0200560:	00002517          	auipc	a0,0x2
ffffffffc0200564:	34050513          	addi	a0,a0,832 # ffffffffc02028a0 <commands+0x208>
ffffffffc0200568:	b4bff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  a7       0x%08x\n", gpr->a7);
ffffffffc020056c:	644c                	ld	a1,136(s0)
ffffffffc020056e:	00002517          	auipc	a0,0x2
ffffffffc0200572:	34a50513          	addi	a0,a0,842 # ffffffffc02028b8 <commands+0x220>
ffffffffc0200576:	b3dff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  s2       0x%08x\n", gpr->s2);
ffffffffc020057a:	684c                	ld	a1,144(s0)
ffffffffc020057c:	00002517          	auipc	a0,0x2
ffffffffc0200580:	35450513          	addi	a0,a0,852 # ffffffffc02028d0 <commands+0x238>
ffffffffc0200584:	b2fff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  s3       0x%08x\n", gpr->s3);
ffffffffc0200588:	6c4c                	ld	a1,152(s0)
ffffffffc020058a:	00002517          	auipc	a0,0x2
ffffffffc020058e:	35e50513          	addi	a0,a0,862 # ffffffffc02028e8 <commands+0x250>
ffffffffc0200592:	b21ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  s4       0x%08x\n", gpr->s4);
ffffffffc0200596:	704c                	ld	a1,160(s0)
ffffffffc0200598:	00002517          	auipc	a0,0x2
ffffffffc020059c:	36850513          	addi	a0,a0,872 # ffffffffc0202900 <commands+0x268>
ffffffffc02005a0:	b13ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  s5       0x%08x\n", gpr->s5);
ffffffffc02005a4:	744c                	ld	a1,168(s0)
ffffffffc02005a6:	00002517          	auipc	a0,0x2
ffffffffc02005aa:	37250513          	addi	a0,a0,882 # ffffffffc0202918 <commands+0x280>
ffffffffc02005ae:	b05ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  s6       0x%08x\n", gpr->s6);
ffffffffc02005b2:	784c                	ld	a1,176(s0)
ffffffffc02005b4:	00002517          	auipc	a0,0x2
ffffffffc02005b8:	37c50513          	addi	a0,a0,892 # ffffffffc0202930 <commands+0x298>
ffffffffc02005bc:	af7ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  s7       0x%08x\n", gpr->s7);
ffffffffc02005c0:	7c4c                	ld	a1,184(s0)
ffffffffc02005c2:	00002517          	auipc	a0,0x2
ffffffffc02005c6:	38650513          	addi	a0,a0,902 # ffffffffc0202948 <commands+0x2b0>
ffffffffc02005ca:	ae9ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  s8       0x%08x\n", gpr->s8);
ffffffffc02005ce:	606c                	ld	a1,192(s0)
ffffffffc02005d0:	00002517          	auipc	a0,0x2
ffffffffc02005d4:	39050513          	addi	a0,a0,912 # ffffffffc0202960 <commands+0x2c8>
ffffffffc02005d8:	adbff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  s9       0x%08x\n", gpr->s9);
ffffffffc02005dc:	646c                	ld	a1,200(s0)
ffffffffc02005de:	00002517          	auipc	a0,0x2
ffffffffc02005e2:	39a50513          	addi	a0,a0,922 # ffffffffc0202978 <commands+0x2e0>
ffffffffc02005e6:	acdff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  s10      0x%08x\n", gpr->s10);
ffffffffc02005ea:	686c                	ld	a1,208(s0)
ffffffffc02005ec:	00002517          	auipc	a0,0x2
ffffffffc02005f0:	3a450513          	addi	a0,a0,932 # ffffffffc0202990 <commands+0x2f8>
ffffffffc02005f4:	abfff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  s11      0x%08x\n", gpr->s11);
ffffffffc02005f8:	6c6c                	ld	a1,216(s0)
ffffffffc02005fa:	00002517          	auipc	a0,0x2
ffffffffc02005fe:	3ae50513          	addi	a0,a0,942 # ffffffffc02029a8 <commands+0x310>
ffffffffc0200602:	ab1ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  t3       0x%08x\n", gpr->t3);
ffffffffc0200606:	706c                	ld	a1,224(s0)
ffffffffc0200608:	00002517          	auipc	a0,0x2
ffffffffc020060c:	3b850513          	addi	a0,a0,952 # ffffffffc02029c0 <commands+0x328>
ffffffffc0200610:	aa3ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  t4       0x%08x\n", gpr->t4);
ffffffffc0200614:	746c                	ld	a1,232(s0)
ffffffffc0200616:	00002517          	auipc	a0,0x2
ffffffffc020061a:	3c250513          	addi	a0,a0,962 # ffffffffc02029d8 <commands+0x340>
ffffffffc020061e:	a95ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  t5       0x%08x\n", gpr->t5);
ffffffffc0200622:	786c                	ld	a1,240(s0)
ffffffffc0200624:	00002517          	auipc	a0,0x2
ffffffffc0200628:	3cc50513          	addi	a0,a0,972 # ffffffffc02029f0 <commands+0x358>
ffffffffc020062c:	a87ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  t6       0x%08x\n", gpr->t6);
ffffffffc0200630:	7c6c                	ld	a1,248(s0)
}
ffffffffc0200632:	6402                	ld	s0,0(sp)
ffffffffc0200634:	60a2                	ld	ra,8(sp)
    cprintf("  t6       0x%08x\n", gpr->t6);
ffffffffc0200636:	00002517          	auipc	a0,0x2
ffffffffc020063a:	3d250513          	addi	a0,a0,978 # ffffffffc0202a08 <commands+0x370>
}
ffffffffc020063e:	0141                	addi	sp,sp,16
    cprintf("  t6       0x%08x\n", gpr->t6);
ffffffffc0200640:	bc8d                	j	ffffffffc02000b2 <cprintf>

ffffffffc0200642 <print_trapframe>:
void print_trapframe(struct trapframe *tf) {
ffffffffc0200642:	1141                	addi	sp,sp,-16
ffffffffc0200644:	e022                	sd	s0,0(sp)
    cprintf("trapframe at %p\n", tf);
ffffffffc0200646:	85aa                	mv	a1,a0
void print_trapframe(struct trapframe *tf) {
ffffffffc0200648:	842a                	mv	s0,a0
    cprintf("trapframe at %p\n", tf);
ffffffffc020064a:	00002517          	auipc	a0,0x2
ffffffffc020064e:	3d650513          	addi	a0,a0,982 # ffffffffc0202a20 <commands+0x388>
void print_trapframe(struct trapframe *tf) {
ffffffffc0200652:	e406                	sd	ra,8(sp)
    cprintf("trapframe at %p\n", tf);
ffffffffc0200654:	a5fff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    print_regs(&tf->gpr);
ffffffffc0200658:	8522                	mv	a0,s0
ffffffffc020065a:	e1dff0ef          	jal	ra,ffffffffc0200476 <print_regs>
    cprintf("  status   0x%08x\n", tf->status);
ffffffffc020065e:	10043583          	ld	a1,256(s0)
ffffffffc0200662:	00002517          	auipc	a0,0x2
ffffffffc0200666:	3d650513          	addi	a0,a0,982 # ffffffffc0202a38 <commands+0x3a0>
ffffffffc020066a:	a49ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  epc      0x%08x\n", tf->epc);
ffffffffc020066e:	10843583          	ld	a1,264(s0)
ffffffffc0200672:	00002517          	auipc	a0,0x2
ffffffffc0200676:	3de50513          	addi	a0,a0,990 # ffffffffc0202a50 <commands+0x3b8>
ffffffffc020067a:	a39ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  badvaddr 0x%08x\n", tf->badvaddr);
ffffffffc020067e:	11043583          	ld	a1,272(s0)
ffffffffc0200682:	00002517          	auipc	a0,0x2
ffffffffc0200686:	3e650513          	addi	a0,a0,998 # ffffffffc0202a68 <commands+0x3d0>
ffffffffc020068a:	a29ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  cause    0x%08x\n", tf->cause);
ffffffffc020068e:	11843583          	ld	a1,280(s0)
}
ffffffffc0200692:	6402                	ld	s0,0(sp)
ffffffffc0200694:	60a2                	ld	ra,8(sp)
    cprintf("  cause    0x%08x\n", tf->cause);
ffffffffc0200696:	00002517          	auipc	a0,0x2
ffffffffc020069a:	3ea50513          	addi	a0,a0,1002 # ffffffffc0202a80 <commands+0x3e8>
}
ffffffffc020069e:	0141                	addi	sp,sp,16
    cprintf("  cause    0x%08x\n", tf->cause);
ffffffffc02006a0:	bc09                	j	ffffffffc02000b2 <cprintf>

ffffffffc02006a2 <interrupt_handler>:

void interrupt_handler(struct trapframe *tf) {
    intptr_t cause = (tf->cause << 1) >> 1;
ffffffffc02006a2:	11853783          	ld	a5,280(a0)
ffffffffc02006a6:	472d                	li	a4,11
ffffffffc02006a8:	0786                	slli	a5,a5,0x1
ffffffffc02006aa:	8385                	srli	a5,a5,0x1
ffffffffc02006ac:	06f76c63          	bltu	a4,a5,ffffffffc0200724 <interrupt_handler+0x82>
ffffffffc02006b0:	00002717          	auipc	a4,0x2
ffffffffc02006b4:	4b070713          	addi	a4,a4,1200 # ffffffffc0202b60 <commands+0x4c8>
ffffffffc02006b8:	078a                	slli	a5,a5,0x2
ffffffffc02006ba:	97ba                	add	a5,a5,a4
ffffffffc02006bc:	439c                	lw	a5,0(a5)
ffffffffc02006be:	97ba                	add	a5,a5,a4
ffffffffc02006c0:	8782                	jr	a5
            break;
        case IRQ_H_SOFT:
            cprintf("Hypervisor software interrupt\n");
            break;
        case IRQ_M_SOFT:
            cprintf("Machine software interrupt\n");
ffffffffc02006c2:	00002517          	auipc	a0,0x2
ffffffffc02006c6:	43650513          	addi	a0,a0,1078 # ffffffffc0202af8 <commands+0x460>
ffffffffc02006ca:	b2e5                	j	ffffffffc02000b2 <cprintf>
            cprintf("Hypervisor software interrupt\n");
ffffffffc02006cc:	00002517          	auipc	a0,0x2
ffffffffc02006d0:	40c50513          	addi	a0,a0,1036 # ffffffffc0202ad8 <commands+0x440>
ffffffffc02006d4:	baf9                	j	ffffffffc02000b2 <cprintf>
            cprintf("User software interrupt\n");
ffffffffc02006d6:	00002517          	auipc	a0,0x2
ffffffffc02006da:	3c250513          	addi	a0,a0,962 # ffffffffc0202a98 <commands+0x400>
ffffffffc02006de:	bad1                	j	ffffffffc02000b2 <cprintf>
            break;
        case IRQ_U_TIMER:
            cprintf("User Timer interrupt\n");
ffffffffc02006e0:	00002517          	auipc	a0,0x2
ffffffffc02006e4:	43850513          	addi	a0,a0,1080 # ffffffffc0202b18 <commands+0x480>
ffffffffc02006e8:	b2e9                	j	ffffffffc02000b2 <cprintf>
void interrupt_handler(struct trapframe *tf) {
ffffffffc02006ea:	1141                	addi	sp,sp,-16
ffffffffc02006ec:	e406                	sd	ra,8(sp)
            // read-only." -- privileged spec1.9.1, 4.1.4, p59
            // In fact, Call sbi_set_timer will clear STIP, or you can clear it
            // directly.
            // cprintf("Supervisor timer interrupt\n");
            // clear_csr(sip, SIP_STIP);
            clock_set_next_event();
ffffffffc02006ee:	d4dff0ef          	jal	ra,ffffffffc020043a <clock_set_next_event>
            if (++ticks % TICK_NUM == 0) {
ffffffffc02006f2:	00007697          	auipc	a3,0x7
ffffffffc02006f6:	e7e68693          	addi	a3,a3,-386 # ffffffffc0207570 <ticks>
ffffffffc02006fa:	629c                	ld	a5,0(a3)
ffffffffc02006fc:	06400713          	li	a4,100
ffffffffc0200700:	0785                	addi	a5,a5,1
ffffffffc0200702:	02e7f733          	remu	a4,a5,a4
ffffffffc0200706:	e29c                	sd	a5,0(a3)
ffffffffc0200708:	cf19                	beqz	a4,ffffffffc0200726 <interrupt_handler+0x84>
            break;
        default:
            print_trapframe(tf);
            break;
    }
}
ffffffffc020070a:	60a2                	ld	ra,8(sp)
ffffffffc020070c:	0141                	addi	sp,sp,16
ffffffffc020070e:	8082                	ret
            cprintf("Supervisor external interrupt\n");
ffffffffc0200710:	00002517          	auipc	a0,0x2
ffffffffc0200714:	43050513          	addi	a0,a0,1072 # ffffffffc0202b40 <commands+0x4a8>
ffffffffc0200718:	ba69                	j	ffffffffc02000b2 <cprintf>
            cprintf("Supervisor software interrupt\n");
ffffffffc020071a:	00002517          	auipc	a0,0x2
ffffffffc020071e:	39e50513          	addi	a0,a0,926 # ffffffffc0202ab8 <commands+0x420>
ffffffffc0200722:	ba41                	j	ffffffffc02000b2 <cprintf>
            print_trapframe(tf);
ffffffffc0200724:	bf39                	j	ffffffffc0200642 <print_trapframe>
}
ffffffffc0200726:	60a2                	ld	ra,8(sp)
    cprintf("%d ticks\n", TICK_NUM);
ffffffffc0200728:	06400593          	li	a1,100
ffffffffc020072c:	00002517          	auipc	a0,0x2
ffffffffc0200730:	40450513          	addi	a0,a0,1028 # ffffffffc0202b30 <commands+0x498>
}
ffffffffc0200734:	0141                	addi	sp,sp,16
    cprintf("%d ticks\n", TICK_NUM);
ffffffffc0200736:	bab5                	j	ffffffffc02000b2 <cprintf>

ffffffffc0200738 <trap>:
            break;
    }
}

static inline void trap_dispatch(struct trapframe *tf) {
    if ((intptr_t)tf->cause < 0) {
ffffffffc0200738:	11853783          	ld	a5,280(a0)
ffffffffc020073c:	0007c763          	bltz	a5,ffffffffc020074a <trap+0x12>
    switch (tf->cause) {
ffffffffc0200740:	472d                	li	a4,11
ffffffffc0200742:	00f76363          	bltu	a4,a5,ffffffffc0200748 <trap+0x10>
 * trapframe and then uses the iret instruction to return from the exception.
 * */
void trap(struct trapframe *tf) {
    // dispatch based on what type of trap occurred
    trap_dispatch(tf);
}
ffffffffc0200746:	8082                	ret
            print_trapframe(tf);
ffffffffc0200748:	bded                	j	ffffffffc0200642 <print_trapframe>
        interrupt_handler(tf);
ffffffffc020074a:	bfa1                	j	ffffffffc02006a2 <interrupt_handler>

ffffffffc020074c <__alltraps>:
ffffffffc020074c:	14011073          	csrw	sscratch,sp
ffffffffc0200750:	712d                	addi	sp,sp,-288
ffffffffc0200752:	e002                	sd	zero,0(sp)
ffffffffc0200754:	e406                	sd	ra,8(sp)
ffffffffc0200756:	ec0e                	sd	gp,24(sp)
ffffffffc0200758:	f012                	sd	tp,32(sp)
ffffffffc020075a:	f416                	sd	t0,40(sp)
ffffffffc020075c:	f81a                	sd	t1,48(sp)
ffffffffc020075e:	fc1e                	sd	t2,56(sp)
ffffffffc0200760:	e0a2                	sd	s0,64(sp)
ffffffffc0200762:	e4a6                	sd	s1,72(sp)
ffffffffc0200764:	e8aa                	sd	a0,80(sp)
ffffffffc0200766:	ecae                	sd	a1,88(sp)
ffffffffc0200768:	f0b2                	sd	a2,96(sp)
ffffffffc020076a:	f4b6                	sd	a3,104(sp)
ffffffffc020076c:	f8ba                	sd	a4,112(sp)
ffffffffc020076e:	fcbe                	sd	a5,120(sp)
ffffffffc0200770:	e142                	sd	a6,128(sp)
ffffffffc0200772:	e546                	sd	a7,136(sp)
ffffffffc0200774:	e94a                	sd	s2,144(sp)
ffffffffc0200776:	ed4e                	sd	s3,152(sp)
ffffffffc0200778:	f152                	sd	s4,160(sp)
ffffffffc020077a:	f556                	sd	s5,168(sp)
ffffffffc020077c:	f95a                	sd	s6,176(sp)
ffffffffc020077e:	fd5e                	sd	s7,184(sp)
ffffffffc0200780:	e1e2                	sd	s8,192(sp)
ffffffffc0200782:	e5e6                	sd	s9,200(sp)
ffffffffc0200784:	e9ea                	sd	s10,208(sp)
ffffffffc0200786:	edee                	sd	s11,216(sp)
ffffffffc0200788:	f1f2                	sd	t3,224(sp)
ffffffffc020078a:	f5f6                	sd	t4,232(sp)
ffffffffc020078c:	f9fa                	sd	t5,240(sp)
ffffffffc020078e:	fdfe                	sd	t6,248(sp)
ffffffffc0200790:	14001473          	csrrw	s0,sscratch,zero
ffffffffc0200794:	100024f3          	csrr	s1,sstatus
ffffffffc0200798:	14102973          	csrr	s2,sepc
ffffffffc020079c:	143029f3          	csrr	s3,stval
ffffffffc02007a0:	14202a73          	csrr	s4,scause
ffffffffc02007a4:	e822                	sd	s0,16(sp)
ffffffffc02007a6:	e226                	sd	s1,256(sp)
ffffffffc02007a8:	e64a                	sd	s2,264(sp)
ffffffffc02007aa:	ea4e                	sd	s3,272(sp)
ffffffffc02007ac:	ee52                	sd	s4,280(sp)
ffffffffc02007ae:	850a                	mv	a0,sp
ffffffffc02007b0:	f89ff0ef          	jal	ra,ffffffffc0200738 <trap>

ffffffffc02007b4 <__trapret>:
ffffffffc02007b4:	6492                	ld	s1,256(sp)
ffffffffc02007b6:	6932                	ld	s2,264(sp)
ffffffffc02007b8:	10049073          	csrw	sstatus,s1
ffffffffc02007bc:	14191073          	csrw	sepc,s2
ffffffffc02007c0:	60a2                	ld	ra,8(sp)
ffffffffc02007c2:	61e2                	ld	gp,24(sp)
ffffffffc02007c4:	7202                	ld	tp,32(sp)
ffffffffc02007c6:	72a2                	ld	t0,40(sp)
ffffffffc02007c8:	7342                	ld	t1,48(sp)
ffffffffc02007ca:	73e2                	ld	t2,56(sp)
ffffffffc02007cc:	6406                	ld	s0,64(sp)
ffffffffc02007ce:	64a6                	ld	s1,72(sp)
ffffffffc02007d0:	6546                	ld	a0,80(sp)
ffffffffc02007d2:	65e6                	ld	a1,88(sp)
ffffffffc02007d4:	7606                	ld	a2,96(sp)
ffffffffc02007d6:	76a6                	ld	a3,104(sp)
ffffffffc02007d8:	7746                	ld	a4,112(sp)
ffffffffc02007da:	77e6                	ld	a5,120(sp)
ffffffffc02007dc:	680a                	ld	a6,128(sp)
ffffffffc02007de:	68aa                	ld	a7,136(sp)
ffffffffc02007e0:	694a                	ld	s2,144(sp)
ffffffffc02007e2:	69ea                	ld	s3,152(sp)
ffffffffc02007e4:	7a0a                	ld	s4,160(sp)
ffffffffc02007e6:	7aaa                	ld	s5,168(sp)
ffffffffc02007e8:	7b4a                	ld	s6,176(sp)
ffffffffc02007ea:	7bea                	ld	s7,184(sp)
ffffffffc02007ec:	6c0e                	ld	s8,192(sp)
ffffffffc02007ee:	6cae                	ld	s9,200(sp)
ffffffffc02007f0:	6d4e                	ld	s10,208(sp)
ffffffffc02007f2:	6dee                	ld	s11,216(sp)
ffffffffc02007f4:	7e0e                	ld	t3,224(sp)
ffffffffc02007f6:	7eae                	ld	t4,232(sp)
ffffffffc02007f8:	7f4e                	ld	t5,240(sp)
ffffffffc02007fa:	7fee                	ld	t6,248(sp)
ffffffffc02007fc:	6142                	ld	sp,16(sp)
ffffffffc02007fe:	10200073          	sret

ffffffffc0200802 <buddy_init>:
#include <pmm.h>
#include <stdio.h>

static void buddy_init(void) {
    // DO NOTHING
}
ffffffffc0200802:	8082                	ret

ffffffffc0200804 <buddy_nr_free_pages>:
    }
}

static size_t buddy_nr_free_pages(void) {
    size_t total_cnt = 0;
    for (size_t i = 0; i < BUDDY_MAX_ORDER; i++) {
ffffffffc0200804:	00007797          	auipc	a5,0x7
ffffffffc0200808:	81c78793          	addi	a5,a5,-2020 # ffffffffc0207020 <buddy_zone+0x10>
ffffffffc020080c:	00007697          	auipc	a3,0x7
ffffffffc0200810:	91c68693          	addi	a3,a3,-1764 # ffffffffc0207128 <slob_manager+0x10>
    size_t total_cnt = 0;
ffffffffc0200814:	4501                	li	a0,0
        total_cnt += buddy_zone.free_area[i].nr_free;
ffffffffc0200816:	0007e703          	lwu	a4,0(a5)
    for (size_t i = 0; i < BUDDY_MAX_ORDER; i++) {
ffffffffc020081a:	07e1                	addi	a5,a5,24
        total_cnt += buddy_zone.free_area[i].nr_free;
ffffffffc020081c:	953a                	add	a0,a0,a4
    for (size_t i = 0; i < BUDDY_MAX_ORDER; i++) {
ffffffffc020081e:	fed79ce3          	bne	a5,a3,ffffffffc0200816 <buddy_nr_free_pages+0x12>
    }
    return total_cnt;
}
ffffffffc0200822:	8082                	ret

ffffffffc0200824 <add_to_free_list>:
    assert(order < BUDDY_MAX_ORDER);
ffffffffc0200824:	47a9                	li	a5,10
ffffffffc0200826:	06b7e663          	bltu	a5,a1,ffffffffc0200892 <add_to_free_list+0x6e>
    buddy_zone.free_area[order].nr_free += page->property;
ffffffffc020082a:	00159713          	slli	a4,a1,0x1
ffffffffc020082e:	972e                	add	a4,a4,a1
ffffffffc0200830:	00371793          	slli	a5,a4,0x3
ffffffffc0200834:	00006717          	auipc	a4,0x6
ffffffffc0200838:	7dc70713          	addi	a4,a4,2012 # ffffffffc0207010 <buddy_zone>
ffffffffc020083c:	973e                	add	a4,a4,a5
ffffffffc020083e:	4b1c                	lw	a5,16(a4)
ffffffffc0200840:	4914                	lw	a3,16(a0)
ffffffffc0200842:	9fb5                	addw	a5,a5,a3
ffffffffc0200844:	cb1c                	sw	a5,16(a4)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
ffffffffc0200846:	671c                	ld	a5,8(a4)
    if (list_empty(&buddy_zone.free_area[order].free_list)) {
ffffffffc0200848:	00f70f63          	beq	a4,a5,ffffffffc0200866 <add_to_free_list+0x42>
        while ((le = list_next(le)) != &buddy_zone.free_area[order].free_list) {
ffffffffc020084c:	00f70c63          	beq	a4,a5,ffffffffc0200864 <add_to_free_list+0x40>
            struct Page *p = le2page(le, page_link);
ffffffffc0200850:	fe878693          	addi	a3,a5,-24
            if (page < p) {
ffffffffc0200854:	02d56063          	bltu	a0,a3,ffffffffc0200874 <add_to_free_list+0x50>
ffffffffc0200858:	6794                	ld	a3,8(a5)
            } else if (list_next(le) ==
ffffffffc020085a:	02d70563          	beq	a4,a3,ffffffffc0200884 <add_to_free_list+0x60>
ffffffffc020085e:	87b6                	mv	a5,a3
        while ((le = list_next(le)) != &buddy_zone.free_area[order].free_list) {
ffffffffc0200860:	fef718e3          	bne	a4,a5,ffffffffc0200850 <add_to_free_list+0x2c>
ffffffffc0200864:	8082                	ret
        list_add(&buddy_zone.free_area[order].free_list, &(page->page_link));
ffffffffc0200866:	01850793          	addi	a5,a0,24
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
ffffffffc020086a:	e31c                	sd	a5,0(a4)
ffffffffc020086c:	e71c                	sd	a5,8(a4)
    elm->next = next;
ffffffffc020086e:	f118                	sd	a4,32(a0)
    elm->prev = prev;
ffffffffc0200870:	ed18                	sd	a4,24(a0)
}
ffffffffc0200872:	8082                	ret
    __list_add(elm, listelm->prev, listelm);
ffffffffc0200874:	6398                	ld	a4,0(a5)
                list_add_before(le, &(page->page_link));
ffffffffc0200876:	01850693          	addi	a3,a0,24
    prev->next = next->prev = elm;
ffffffffc020087a:	e394                	sd	a3,0(a5)
ffffffffc020087c:	e714                	sd	a3,8(a4)
    elm->next = next;
ffffffffc020087e:	f11c                	sd	a5,32(a0)
    elm->prev = prev;
ffffffffc0200880:	ed18                	sd	a4,24(a0)
}
ffffffffc0200882:	8082                	ret
                list_add(le, &(page->page_link));
ffffffffc0200884:	01850693          	addi	a3,a0,24
    prev->next = next->prev = elm;
ffffffffc0200888:	e314                	sd	a3,0(a4)
ffffffffc020088a:	e794                	sd	a3,8(a5)
    elm->next = next;
ffffffffc020088c:	f118                	sd	a4,32(a0)
    elm->prev = prev;
ffffffffc020088e:	ed1c                	sd	a5,24(a0)
}
ffffffffc0200890:	8082                	ret
static void add_to_free_list(struct Page *page, size_t order) {
ffffffffc0200892:	1141                	addi	sp,sp,-16
    assert(order < BUDDY_MAX_ORDER);
ffffffffc0200894:	00002697          	auipc	a3,0x2
ffffffffc0200898:	2fc68693          	addi	a3,a3,764 # ffffffffc0202b90 <commands+0x4f8>
ffffffffc020089c:	00002617          	auipc	a2,0x2
ffffffffc02008a0:	30c60613          	addi	a2,a2,780 # ffffffffc0202ba8 <commands+0x510>
ffffffffc02008a4:	02b00593          	li	a1,43
ffffffffc02008a8:	00002517          	auipc	a0,0x2
ffffffffc02008ac:	31850513          	addi	a0,a0,792 # ffffffffc0202bc0 <commands+0x528>
static void add_to_free_list(struct Page *page, size_t order) {
ffffffffc02008b0:	e406                	sd	ra,8(sp)
    assert(order < BUDDY_MAX_ORDER);
ffffffffc02008b2:	afbff0ef          	jal	ra,ffffffffc02003ac <__panic>

ffffffffc02008b6 <buddy_free_pages>:
static void buddy_free_pages(struct Page *base, size_t n) {
ffffffffc02008b6:	715d                	addi	sp,sp,-80
ffffffffc02008b8:	e0a2                	sd	s0,64(sp)
ffffffffc02008ba:	86ae                	mv	a3,a1
ffffffffc02008bc:	e486                	sd	ra,72(sp)
ffffffffc02008be:	fc26                	sd	s1,56(sp)
ffffffffc02008c0:	f84a                	sd	s2,48(sp)
ffffffffc02008c2:	f44e                	sd	s3,40(sp)
ffffffffc02008c4:	f052                	sd	s4,32(sp)
ffffffffc02008c6:	ec56                	sd	s5,24(sp)
ffffffffc02008c8:	e85a                	sd	s6,16(sp)
ffffffffc02008ca:	e45e                	sd	s7,8(sp)
ffffffffc02008cc:	842a                	mv	s0,a0
    for (size_t i = 0; i < BUDDY_MAX_ORDER; i++) {
ffffffffc02008ce:	4581                	li	a1,0
        if (n <= (1 << i)) {
ffffffffc02008d0:	4705                	li	a4,1
    for (size_t i = 0; i < BUDDY_MAX_ORDER; i++) {
ffffffffc02008d2:	462d                	li	a2,11
        if (n <= (1 << i)) {
ffffffffc02008d4:	00b717bb          	sllw	a5,a4,a1
ffffffffc02008d8:	0cd7f163          	bgeu	a5,a3,ffffffffc020099a <buddy_free_pages+0xe4>
    for (size_t i = 0; i < BUDDY_MAX_ORDER; i++) {
ffffffffc02008dc:	0585                	addi	a1,a1,1
ffffffffc02008de:	fec59be3          	bne	a1,a2,ffffffffc02008d4 <buddy_free_pages+0x1e>
ffffffffc02008e2:	04800693          	li	a3,72
ffffffffc02008e6:	4901                	li	s2,0
ffffffffc02008e8:	4605                	li	a2,1
    size_t order = 0;
ffffffffc02008ea:	4581                	li	a1,0
    for (; p != base + n; p++) {
ffffffffc02008ec:	96a2                	add	a3,a3,s0
ffffffffc02008ee:	87a2                	mv	a5,s0
 * test_bit - Determine whether a bit is set
 * @nr:     the bit to test
 * @addr:   the address to count from
 * */
static inline bool test_bit(int nr, volatile void *addr) {
    return (((*(volatile unsigned long *)addr) >> nr) & 1);
ffffffffc02008f0:	6798                	ld	a4,8(a5)
        assert(!PageReserved(p) && !PageProperty(p));
ffffffffc02008f2:	8b05                	andi	a4,a4,1
ffffffffc02008f4:	12071863          	bnez	a4,ffffffffc0200a24 <buddy_free_pages+0x16e>
ffffffffc02008f8:	6798                	ld	a4,8(a5)
ffffffffc02008fa:	8b09                	andi	a4,a4,2
ffffffffc02008fc:	12071463          	bnez	a4,ffffffffc0200a24 <buddy_free_pages+0x16e>
        p->flags = 0;
ffffffffc0200900:	0007b423          	sd	zero,8(a5)



static inline int page_ref(struct Page *page) { return page->ref; }

static inline void set_page_ref(struct Page *page, int val) { page->ref = val; }
ffffffffc0200904:	0007a023          	sw	zero,0(a5)
    for (; p != base + n; p++) {
ffffffffc0200908:	04878793          	addi	a5,a5,72
ffffffffc020090c:	fed792e3          	bne	a5,a3,ffffffffc02008f0 <buddy_free_pages+0x3a>
    base->property = n;
ffffffffc0200910:	c810                	sw	a2,16(s0)
    __op_bit(or, __NOP, nr, ((volatile unsigned long *)addr));
ffffffffc0200912:	4789                	li	a5,2
ffffffffc0200914:	00840713          	addi	a4,s0,8
ffffffffc0200918:	40f7302f          	amoor.d	zero,a5,(a4)
    add_to_free_list(page, order);
ffffffffc020091c:	8522                	mv	a0,s0
ffffffffc020091e:	f07ff0ef          	jal	ra,ffffffffc0200824 <add_to_free_list>
    while (order < BUDDY_MAX_ORDER - 1) {
ffffffffc0200922:	47a9                	li	a5,10
ffffffffc0200924:	06f90063          	beq	s2,a5,ffffffffc0200984 <buddy_free_pages+0xce>
ffffffffc0200928:	00191493          	slli	s1,s2,0x1
ffffffffc020092c:	94ca                	add	s1,s1,s2
ffffffffc020092e:	048e                	slli	s1,s1,0x3
ffffffffc0200930:	00006797          	auipc	a5,0x6
ffffffffc0200934:	6e078793          	addi	a5,a5,1760 # ffffffffc0207010 <buddy_zone>
ffffffffc0200938:	94be                	add	s1,s1,a5
ffffffffc020093a:	2905                	addiw	s2,s2,1
                buddy_zone.free_area[order].nr_free -= 1 << (order + 1);
ffffffffc020093c:	4b05                	li	s6,1
    __op_bit(and, __NOT, nr, ((volatile unsigned long *)addr));
ffffffffc020093e:	5af5                	li	s5,-3
    while (order < BUDDY_MAX_ORDER - 1) {
ffffffffc0200940:	4a29                	li	s4,10
    return listelm->prev;
ffffffffc0200942:	6c18                	ld	a4,24(s0)
        if (le != &(buddy_zone.free_area[order].free_list)) {
ffffffffc0200944:	02e48063          	beq	s1,a4,ffffffffc0200964 <buddy_free_pages+0xae>
            if (prev_page + prev_page->property == page) {
ffffffffc0200948:	ff872603          	lw	a2,-8(a4)
            struct Page *prev_page = le2page(le, page_link);
ffffffffc020094c:	fe870993          	addi	s3,a4,-24
            if (prev_page + prev_page->property == page) {
ffffffffc0200950:	02061693          	slli	a3,a2,0x20
ffffffffc0200954:	9281                	srli	a3,a3,0x20
ffffffffc0200956:	00369793          	slli	a5,a3,0x3
ffffffffc020095a:	97b6                	add	a5,a5,a3
ffffffffc020095c:	078e                	slli	a5,a5,0x3
ffffffffc020095e:	97ce                	add	a5,a5,s3
ffffffffc0200960:	08f40563          	beq	s0,a5,ffffffffc02009ea <buddy_free_pages+0x134>
    return listelm->next;
ffffffffc0200964:	7014                	ld	a3,32(s0)
        if (le != &(buddy_zone.free_area[order].free_list)) {
ffffffffc0200966:	00968f63          	beq	a3,s1,ffffffffc0200984 <buddy_free_pages+0xce>
            if (page + page->property == next_page) {
ffffffffc020096a:	480c                	lw	a1,16(s0)
            struct Page *next_page = le2page(le, page_link);
ffffffffc020096c:	fe868713          	addi	a4,a3,-24
            if (page + page->property == next_page) {
ffffffffc0200970:	02059613          	slli	a2,a1,0x20
ffffffffc0200974:	9201                	srli	a2,a2,0x20
ffffffffc0200976:	00361793          	slli	a5,a2,0x3
ffffffffc020097a:	97b2                	add	a5,a5,a2
ffffffffc020097c:	078e                	slli	a5,a5,0x3
ffffffffc020097e:	97a2                	add	a5,a5,s0
ffffffffc0200980:	02e78663          	beq	a5,a4,ffffffffc02009ac <buddy_free_pages+0xf6>
}
ffffffffc0200984:	60a6                	ld	ra,72(sp)
ffffffffc0200986:	6406                	ld	s0,64(sp)
ffffffffc0200988:	74e2                	ld	s1,56(sp)
ffffffffc020098a:	7942                	ld	s2,48(sp)
ffffffffc020098c:	79a2                	ld	s3,40(sp)
ffffffffc020098e:	7a02                	ld	s4,32(sp)
ffffffffc0200990:	6ae2                	ld	s5,24(sp)
ffffffffc0200992:	6b42                	ld	s6,16(sp)
ffffffffc0200994:	6ba2                	ld	s7,8(sp)
ffffffffc0200996:	6161                	addi	sp,sp,80
ffffffffc0200998:	8082                	ret
    n = 1 << order;
ffffffffc020099a:	00b7163b          	sllw	a2,a4,a1
    for (; p != base + n; p++) {
ffffffffc020099e:	00361693          	slli	a3,a2,0x3
ffffffffc02009a2:	96b2                	add	a3,a3,a2
    int order = (int)nearest_order(n);
ffffffffc02009a4:	0005891b          	sext.w	s2,a1
    for (; p != base + n; p++) {
ffffffffc02009a8:	068e                	slli	a3,a3,0x3
ffffffffc02009aa:	b789                	j	ffffffffc02008ec <buddy_free_pages+0x36>
    __list_del(listelm->prev, listelm->next);
ffffffffc02009ac:	6288                	ld	a0,0(a3)
ffffffffc02009ae:	6690                	ld	a2,8(a3)
                buddy_zone.free_area[order].nr_free -= 1 << (order + 1);
ffffffffc02009b0:	4898                	lw	a4,16(s1)
ffffffffc02009b2:	012b17bb          	sllw	a5,s6,s2
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
ffffffffc02009b6:	e510                	sd	a2,8(a0)
    next->prev = prev;
ffffffffc02009b8:	e208                	sd	a0,0(a2)
    __list_del(listelm->prev, listelm->next);
ffffffffc02009ba:	6c08                	ld	a0,24(s0)
ffffffffc02009bc:	7010                	ld	a2,32(s0)
ffffffffc02009be:	9f1d                	subw	a4,a4,a5
                page->property <<= 1;
ffffffffc02009c0:	0015979b          	slliw	a5,a1,0x1
    prev->next = next;
ffffffffc02009c4:	e510                	sd	a2,8(a0)
    next->prev = prev;
ffffffffc02009c6:	e208                	sd	a0,0(a2)
                buddy_zone.free_area[order].nr_free -= 1 << (order + 1);
ffffffffc02009c8:	c898                	sw	a4,16(s1)
                page->property <<= 1;
ffffffffc02009ca:	c81c                	sw	a5,16(s0)
                buddy_zone.free_area[order].nr_free -= 1 << (order + 1);
ffffffffc02009cc:	00090b9b          	sext.w	s7,s2
ffffffffc02009d0:	ff068793          	addi	a5,a3,-16
ffffffffc02009d4:	6157b02f          	amoand.d	zero,s5,(a5)
                add_to_free_list(page, order);
ffffffffc02009d8:	85de                	mv	a1,s7
ffffffffc02009da:	8522                	mv	a0,s0
ffffffffc02009dc:	e49ff0ef          	jal	ra,ffffffffc0200824 <add_to_free_list>
    while (order < BUDDY_MAX_ORDER - 1) {
ffffffffc02009e0:	04e1                	addi	s1,s1,24
ffffffffc02009e2:	2905                	addiw	s2,s2,1
ffffffffc02009e4:	f54b9fe3          	bne	s7,s4,ffffffffc0200942 <buddy_free_pages+0x8c>
ffffffffc02009e8:	bf71                	j	ffffffffc0200984 <buddy_free_pages+0xce>
    __list_del(listelm->prev, listelm->next);
ffffffffc02009ea:	6308                	ld	a0,0(a4)
ffffffffc02009ec:	670c                	ld	a1,8(a4)
                buddy_zone.free_area[order].nr_free -= 1 << (order + 1);
ffffffffc02009ee:	489c                	lw	a5,16(s1)
ffffffffc02009f0:	012b16bb          	sllw	a3,s6,s2
    prev->next = next;
ffffffffc02009f4:	e50c                	sd	a1,8(a0)
    next->prev = prev;
ffffffffc02009f6:	e188                	sd	a0,0(a1)
    __list_del(listelm->prev, listelm->next);
ffffffffc02009f8:	6c08                	ld	a0,24(s0)
ffffffffc02009fa:	700c                	ld	a1,32(s0)
ffffffffc02009fc:	9f95                	subw	a5,a5,a3
                prev_page->property <<= 1;
ffffffffc02009fe:	0016161b          	slliw	a2,a2,0x1
    prev->next = next;
ffffffffc0200a02:	e50c                	sd	a1,8(a0)
    next->prev = prev;
ffffffffc0200a04:	e188                	sd	a0,0(a1)
                buddy_zone.free_area[order].nr_free -= 1 << (order + 1);
ffffffffc0200a06:	c89c                	sw	a5,16(s1)
                prev_page->property <<= 1;
ffffffffc0200a08:	fec72c23          	sw	a2,-8(a4)
                buddy_zone.free_area[order].nr_free -= 1 << (order + 1);
ffffffffc0200a0c:	00090b9b          	sext.w	s7,s2
ffffffffc0200a10:	00840793          	addi	a5,s0,8
ffffffffc0200a14:	6157b02f          	amoand.d	zero,s5,(a5)
                add_to_free_list(page, order);
ffffffffc0200a18:	85de                	mv	a1,s7
ffffffffc0200a1a:	854e                	mv	a0,s3
ffffffffc0200a1c:	e09ff0ef          	jal	ra,ffffffffc0200824 <add_to_free_list>
                page = prev_page;
ffffffffc0200a20:	844e                	mv	s0,s3
                continue;
ffffffffc0200a22:	bf7d                	j	ffffffffc02009e0 <buddy_free_pages+0x12a>
        assert(!PageReserved(p) && !PageProperty(p));
ffffffffc0200a24:	00002697          	auipc	a3,0x2
ffffffffc0200a28:	1b468693          	addi	a3,a3,436 # ffffffffc0202bd8 <commands+0x540>
ffffffffc0200a2c:	00002617          	auipc	a2,0x2
ffffffffc0200a30:	17c60613          	addi	a2,a2,380 # ffffffffc0202ba8 <commands+0x510>
ffffffffc0200a34:	0c500593          	li	a1,197
ffffffffc0200a38:	00002517          	auipc	a0,0x2
ffffffffc0200a3c:	18850513          	addi	a0,a0,392 # ffffffffc0202bc0 <commands+0x528>
ffffffffc0200a40:	96dff0ef          	jal	ra,ffffffffc02003ac <__panic>

ffffffffc0200a44 <buddy_alloc_pages>:
static struct Page *buddy_alloc_pages(size_t n) {
ffffffffc0200a44:	715d                	addi	sp,sp,-80
ffffffffc0200a46:	f44e                	sd	s3,40(sp)
ffffffffc0200a48:	e486                	sd	ra,72(sp)
ffffffffc0200a4a:	e0a2                	sd	s0,64(sp)
ffffffffc0200a4c:	fc26                	sd	s1,56(sp)
ffffffffc0200a4e:	f84a                	sd	s2,48(sp)
ffffffffc0200a50:	f052                	sd	s4,32(sp)
ffffffffc0200a52:	ec56                	sd	s5,24(sp)
ffffffffc0200a54:	e85a                	sd	s6,16(sp)
ffffffffc0200a56:	e45e                	sd	s7,8(sp)
    for (size_t i = 0; i < BUDDY_MAX_ORDER; i++) {
ffffffffc0200a58:	4981                	li	s3,0
        if (n <= (1 << i)) {
ffffffffc0200a5a:	4705                	li	a4,1
    for (size_t i = 0; i < BUDDY_MAX_ORDER; i++) {
ffffffffc0200a5c:	46ad                	li	a3,11
        if (n <= (1 << i)) {
ffffffffc0200a5e:	013717bb          	sllw	a5,a4,s3
ffffffffc0200a62:	0ca7ff63          	bgeu	a5,a0,ffffffffc0200b40 <buddy_alloc_pages+0xfc>
    for (size_t i = 0; i < BUDDY_MAX_ORDER; i++) {
ffffffffc0200a66:	0985                	addi	s3,s3,1
ffffffffc0200a68:	fed99be3          	bne	s3,a3,ffffffffc0200a5e <buddy_alloc_pages+0x1a>
ffffffffc0200a6c:	4981                	li	s3,0
    while (order < BUDDY_MAX_ORDER) {
ffffffffc0200a6e:	00199713          	slli	a4,s3,0x1
ffffffffc0200a72:	974e                	add	a4,a4,s3
ffffffffc0200a74:	070e                	slli	a4,a4,0x3
ffffffffc0200a76:	00006a17          	auipc	s4,0x6
ffffffffc0200a7a:	59aa0a13          	addi	s4,s4,1434 # ffffffffc0207010 <buddy_zone>
ffffffffc0200a7e:	9752                	add	a4,a4,s4
    int order = order_min;
ffffffffc0200a80:	894e                	mv	s2,s3
    while (order < BUDDY_MAX_ORDER) {
ffffffffc0200a82:	46ad                	li	a3,11
    return list->next == list;
ffffffffc0200a84:	671c                	ld	a5,8(a4)
        if (!list_empty(&buddy_zone.free_area[order].free_list)) {
ffffffffc0200a86:	02f71263          	bne	a4,a5,ffffffffc0200aaa <buddy_alloc_pages+0x66>
        order++;
ffffffffc0200a8a:	2905                	addiw	s2,s2,1
    while (order < BUDDY_MAX_ORDER) {
ffffffffc0200a8c:	0761                	addi	a4,a4,24
ffffffffc0200a8e:	fed91be3          	bne	s2,a3,ffffffffc0200a84 <buddy_alloc_pages+0x40>
        return NULL;
ffffffffc0200a92:	4501                	li	a0,0
}
ffffffffc0200a94:	60a6                	ld	ra,72(sp)
ffffffffc0200a96:	6406                	ld	s0,64(sp)
ffffffffc0200a98:	74e2                	ld	s1,56(sp)
ffffffffc0200a9a:	7942                	ld	s2,48(sp)
ffffffffc0200a9c:	79a2                	ld	s3,40(sp)
ffffffffc0200a9e:	7a02                	ld	s4,32(sp)
ffffffffc0200aa0:	6ae2                	ld	s5,24(sp)
ffffffffc0200aa2:	6b42                	ld	s6,16(sp)
ffffffffc0200aa4:	6ba2                	ld	s7,8(sp)
ffffffffc0200aa6:	6161                	addi	sp,sp,80
ffffffffc0200aa8:	8082                	ret
ffffffffc0200aaa:	00191493          	slli	s1,s2,0x1
ffffffffc0200aae:	94ca                	add	s1,s1,s2
ffffffffc0200ab0:	048e                	slli	s1,s1,0x3
ffffffffc0200ab2:	fff90b9b          	addiw	s7,s2,-1
ffffffffc0200ab6:	94d2                	add	s1,s1,s4
        size_t page_cnt = 1 << (order - 1);
ffffffffc0200ab8:	4b05                	li	s6,1
    __op_bit(or, __NOP, nr, ((volatile unsigned long *)addr));
ffffffffc0200aba:	4a89                	li	s5,2
ffffffffc0200abc:	a889                	j	ffffffffc0200b0e <buddy_alloc_pages+0xca>
    __list_del(listelm->prev, listelm->next);
ffffffffc0200abe:	0007b803          	ld	a6,0(a5)
ffffffffc0200ac2:	678c                	ld	a1,8(a5)
ffffffffc0200ac4:	397d                	addiw	s2,s2,-1
ffffffffc0200ac6:	012b163b          	sllw	a2,s6,s2
    prev->next = next;
ffffffffc0200aca:	00b83423          	sd	a1,8(a6)
        buddy_zone.free_area[order].nr_free -= page_cnt << 1;
ffffffffc0200ace:	0016189b          	slliw	a7,a2,0x1
        struct Page *rhs_page = lhs_page + page_cnt;
ffffffffc0200ad2:	00361413          	slli	s0,a2,0x3
    next->prev = prev;
ffffffffc0200ad6:	0105b023          	sd	a6,0(a1)
        buddy_zone.free_area[order].nr_free -= page_cnt << 1;
ffffffffc0200ada:	411686bb          	subw	a3,a3,a7
        struct Page *rhs_page = lhs_page + page_cnt;
ffffffffc0200ade:	9432                	add	s0,s0,a2
        buddy_zone.free_area[order].nr_free -= page_cnt << 1;
ffffffffc0200ae0:	c894                	sw	a3,16(s1)
        struct Page *rhs_page = lhs_page + page_cnt;
ffffffffc0200ae2:	040e                	slli	s0,s0,0x3
ffffffffc0200ae4:	942a                	add	s0,s0,a0
        lhs_page->property = page_cnt;
ffffffffc0200ae6:	fec7ac23          	sw	a2,-8(a5)
        rhs_page->property = page_cnt;
ffffffffc0200aea:	c810                	sw	a2,16(s0)
ffffffffc0200aec:	00840793          	addi	a5,s0,8
ffffffffc0200af0:	4157b02f          	amoor.d	zero,s5,(a5)
        add_to_free_list(lhs_page, order);
ffffffffc0200af4:	85de                	mv	a1,s7
ffffffffc0200af6:	d2fff0ef          	jal	ra,ffffffffc0200824 <add_to_free_list>
        add_to_free_list(rhs_page, order);
ffffffffc0200afa:	85de                	mv	a1,s7
ffffffffc0200afc:	8522                	mv	a0,s0
ffffffffc0200afe:	d27ff0ef          	jal	ra,ffffffffc0200824 <add_to_free_list>
    return listelm->next;
ffffffffc0200b02:	ff04b783          	ld	a5,-16(s1)
        assert(le != &buddy_zone.free_area[order].free_list);
ffffffffc0200b06:	14a1                	addi	s1,s1,-24
ffffffffc0200b08:	1bfd                	addi	s7,s7,-1
ffffffffc0200b0a:	02978d63          	beq	a5,s1,ffffffffc0200b44 <buddy_alloc_pages+0x100>
        buddy_zone.free_area[order].nr_free -= page_cnt << 1;
ffffffffc0200b0e:	4894                	lw	a3,16(s1)
        struct Page *lhs_page = le2page(le, page_link);
ffffffffc0200b10:	fe878513          	addi	a0,a5,-24
    while (order > order_min) {
ffffffffc0200b14:	fb29c5e3          	blt	s3,s2,ffffffffc0200abe <buddy_alloc_pages+0x7a>
    buddy_zone.free_area[order].nr_free -= page->property;
ffffffffc0200b18:	ff87a603          	lw	a2,-8(a5)
ffffffffc0200b1c:	00191713          	slli	a4,s2,0x1
ffffffffc0200b20:	993a                	add	s2,s2,a4
ffffffffc0200b22:	090e                	slli	s2,s2,0x3
ffffffffc0200b24:	9e91                	subw	a3,a3,a2
ffffffffc0200b26:	9a4a                	add	s4,s4,s2
ffffffffc0200b28:	00da2823          	sw	a3,16(s4)
    __op_bit(and, __NOT, nr, ((volatile unsigned long *)addr));
ffffffffc0200b2c:	5775                	li	a4,-3
ffffffffc0200b2e:	ff078693          	addi	a3,a5,-16
ffffffffc0200b32:	60e6b02f          	amoand.d	zero,a4,(a3)
    __list_del(listelm->prev, listelm->next);
ffffffffc0200b36:	6398                	ld	a4,0(a5)
ffffffffc0200b38:	679c                	ld	a5,8(a5)
    prev->next = next;
ffffffffc0200b3a:	e71c                	sd	a5,8(a4)
    next->prev = prev;
ffffffffc0200b3c:	e398                	sd	a4,0(a5)
    return page;
ffffffffc0200b3e:	bf99                	j	ffffffffc0200a94 <buddy_alloc_pages+0x50>
    int order_min = (int)nearest_order(n);
ffffffffc0200b40:	2981                	sext.w	s3,s3
ffffffffc0200b42:	b735                	j	ffffffffc0200a6e <buddy_alloc_pages+0x2a>
        assert(le != &buddy_zone.free_area[order].free_list);
ffffffffc0200b44:	00002697          	auipc	a3,0x2
ffffffffc0200b48:	0bc68693          	addi	a3,a3,188 # ffffffffc0202c00 <commands+0x568>
ffffffffc0200b4c:	00002617          	auipc	a2,0x2
ffffffffc0200b50:	05c60613          	addi	a2,a2,92 # ffffffffc0202ba8 <commands+0x510>
ffffffffc0200b54:	0ac00593          	li	a1,172
ffffffffc0200b58:	00002517          	auipc	a0,0x2
ffffffffc0200b5c:	06850513          	addi	a0,a0,104 # ffffffffc0202bc0 <commands+0x528>
ffffffffc0200b60:	84dff0ef          	jal	ra,ffffffffc02003ac <__panic>

ffffffffc0200b64 <buddy_init_memmap>:
static void buddy_init_memmap(struct Page *base, size_t n) {
ffffffffc0200b64:	7159                	addi	sp,sp,-112
ffffffffc0200b66:	f486                	sd	ra,104(sp)
ffffffffc0200b68:	f0a2                	sd	s0,96(sp)
ffffffffc0200b6a:	eca6                	sd	s1,88(sp)
ffffffffc0200b6c:	e8ca                	sd	s2,80(sp)
ffffffffc0200b6e:	e4ce                	sd	s3,72(sp)
ffffffffc0200b70:	e0d2                	sd	s4,64(sp)
ffffffffc0200b72:	fc56                	sd	s5,56(sp)
ffffffffc0200b74:	f85a                	sd	s6,48(sp)
ffffffffc0200b76:	f45e                	sd	s7,40(sp)
ffffffffc0200b78:	f062                	sd	s8,32(sp)
ffffffffc0200b7a:	ec66                	sd	s9,24(sp)
ffffffffc0200b7c:	e86a                	sd	s10,16(sp)
ffffffffc0200b7e:	e46e                	sd	s11,8(sp)
    assert(n > 0);
ffffffffc0200b80:	c5e5                	beqz	a1,ffffffffc0200c68 <buddy_init_memmap+0x104>
    for (; p != base + n; p++) {
ffffffffc0200b82:	00359693          	slli	a3,a1,0x3
ffffffffc0200b86:	96ae                	add	a3,a3,a1
ffffffffc0200b88:	068e                	slli	a3,a3,0x3
ffffffffc0200b8a:	96aa                	add	a3,a3,a0
ffffffffc0200b8c:	8c2e                	mv	s8,a1
ffffffffc0200b8e:	8caa                	mv	s9,a0
ffffffffc0200b90:	87aa                	mv	a5,a0
ffffffffc0200b92:	00d50f63          	beq	a0,a3,ffffffffc0200bb0 <buddy_init_memmap+0x4c>
    return (((*(volatile unsigned long *)addr) >> nr) & 1);
ffffffffc0200b96:	6798                	ld	a4,8(a5)
        assert(PageReserved(p));
ffffffffc0200b98:	8b05                	andi	a4,a4,1
ffffffffc0200b9a:	c75d                	beqz	a4,ffffffffc0200c48 <buddy_init_memmap+0xe4>
        p->flags = p->property = 0;
ffffffffc0200b9c:	0007a823          	sw	zero,16(a5)
ffffffffc0200ba0:	0007b423          	sd	zero,8(a5)
ffffffffc0200ba4:	0007a023          	sw	zero,0(a5)
    for (; p != base + n; p++) {
ffffffffc0200ba8:	04878793          	addi	a5,a5,72
ffffffffc0200bac:	fed795e3          	bne	a5,a3,ffffffffc0200b96 <buddy_init_memmap+0x32>
ffffffffc0200bb0:	00006b17          	auipc	s6,0x6
ffffffffc0200bb4:	550b0b13          	addi	s6,s6,1360 # ffffffffc0207100 <buddy_zone+0xf0>
ffffffffc0200bb8:	00006d97          	auipc	s11,0x6
ffffffffc0200bbc:	458d8d93          	addi	s11,s11,1112 # ffffffffc0207010 <buddy_zone>
ffffffffc0200bc0:	4d29                	li	s10,10
    __op_bit(or, __NOP, nr, ((volatile unsigned long *)addr));
ffffffffc0200bc2:	4a89                	li	s5,2
        size_t page_cnt = 1 << order;
ffffffffc0200bc4:	4785                	li	a5,1
ffffffffc0200bc6:	01a7993b          	sllw	s2,a5,s10
    elm->prev = elm->next = elm;
ffffffffc0200bca:	016b3423          	sd	s6,8(s6)
ffffffffc0200bce:	016b3023          	sd	s6,0(s6)
        buddy_zone.free_area[order].nr_free = 0;
ffffffffc0200bd2:	000b2823          	sw	zero,16(s6)
        size_t block_cnt = n / page_cnt;
ffffffffc0200bd6:	032c59b3          	divu	s3,s8,s2
        size_t page_cnt = 1 << order;
ffffffffc0200bda:	8bca                	mv	s7,s2
        for (size_t i = 0; i < block_cnt; i++) {
ffffffffc0200bdc:	032c6663          	bltu	s8,s2,ffffffffc0200c08 <buddy_init_memmap+0xa4>
ffffffffc0200be0:	00391a13          	slli	s4,s2,0x3
ffffffffc0200be4:	9a4a                	add	s4,s4,s2
ffffffffc0200be6:	0a0e                	slli	s4,s4,0x3
ffffffffc0200be8:	8466                	mv	s0,s9
ffffffffc0200bea:	4481                	li	s1,0
            page->property = page_cnt;
ffffffffc0200bec:	01242823          	sw	s2,16(s0)
ffffffffc0200bf0:	00840793          	addi	a5,s0,8
ffffffffc0200bf4:	4157b02f          	amoor.d	zero,s5,(a5)
            add_to_free_list(page, order);
ffffffffc0200bf8:	8522                	mv	a0,s0
ffffffffc0200bfa:	85ea                	mv	a1,s10
        for (size_t i = 0; i < block_cnt; i++) {
ffffffffc0200bfc:	0485                	addi	s1,s1,1
            add_to_free_list(page, order);
ffffffffc0200bfe:	c27ff0ef          	jal	ra,ffffffffc0200824 <add_to_free_list>
        for (size_t i = 0; i < block_cnt; i++) {
ffffffffc0200c02:	9452                	add	s0,s0,s4
ffffffffc0200c04:	ff34e4e3          	bltu	s1,s3,ffffffffc0200bec <buddy_init_memmap+0x88>
        n -= block_cnt * page_cnt;
ffffffffc0200c08:	3bfd                	addiw	s7,s7,-1
ffffffffc0200c0a:	017c7c33          	and	s8,s8,s7
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200c0e:	1d7d                	addi	s10,s10,-1
ffffffffc0200c10:	fe8b0793          	addi	a5,s6,-24
        p += block_cnt * page_cnt;
ffffffffc0200c14:	033909b3          	mul	s3,s2,s3
ffffffffc0200c18:	00399913          	slli	s2,s3,0x3
ffffffffc0200c1c:	994e                	add	s2,s2,s3
ffffffffc0200c1e:	090e                	slli	s2,s2,0x3
ffffffffc0200c20:	9cca                	add	s9,s9,s2
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200c22:	01bb0463          	beq	s6,s11,ffffffffc0200c2a <buddy_init_memmap+0xc6>
ffffffffc0200c26:	8b3e                	mv	s6,a5
ffffffffc0200c28:	bf71                	j	ffffffffc0200bc4 <buddy_init_memmap+0x60>
}
ffffffffc0200c2a:	70a6                	ld	ra,104(sp)
ffffffffc0200c2c:	7406                	ld	s0,96(sp)
ffffffffc0200c2e:	64e6                	ld	s1,88(sp)
ffffffffc0200c30:	6946                	ld	s2,80(sp)
ffffffffc0200c32:	69a6                	ld	s3,72(sp)
ffffffffc0200c34:	6a06                	ld	s4,64(sp)
ffffffffc0200c36:	7ae2                	ld	s5,56(sp)
ffffffffc0200c38:	7b42                	ld	s6,48(sp)
ffffffffc0200c3a:	7ba2                	ld	s7,40(sp)
ffffffffc0200c3c:	7c02                	ld	s8,32(sp)
ffffffffc0200c3e:	6ce2                	ld	s9,24(sp)
ffffffffc0200c40:	6d42                	ld	s10,16(sp)
ffffffffc0200c42:	6da2                	ld	s11,8(sp)
ffffffffc0200c44:	6165                	addi	sp,sp,112
ffffffffc0200c46:	8082                	ret
        assert(PageReserved(p));
ffffffffc0200c48:	00002697          	auipc	a3,0x2
ffffffffc0200c4c:	ff068693          	addi	a3,a3,-16 # ffffffffc0202c38 <commands+0x5a0>
ffffffffc0200c50:	00002617          	auipc	a2,0x2
ffffffffc0200c54:	f5860613          	addi	a2,a2,-168 # ffffffffc0202ba8 <commands+0x510>
ffffffffc0200c58:	05800593          	li	a1,88
ffffffffc0200c5c:	00002517          	auipc	a0,0x2
ffffffffc0200c60:	f6450513          	addi	a0,a0,-156 # ffffffffc0202bc0 <commands+0x528>
ffffffffc0200c64:	f48ff0ef          	jal	ra,ffffffffc02003ac <__panic>
    assert(n > 0);
ffffffffc0200c68:	00002697          	auipc	a3,0x2
ffffffffc0200c6c:	fc868693          	addi	a3,a3,-56 # ffffffffc0202c30 <commands+0x598>
ffffffffc0200c70:	00002617          	auipc	a2,0x2
ffffffffc0200c74:	f3860613          	addi	a2,a2,-200 # ffffffffc0202ba8 <commands+0x510>
ffffffffc0200c78:	05300593          	li	a1,83
ffffffffc0200c7c:	00002517          	auipc	a0,0x2
ffffffffc0200c80:	f4450513          	addi	a0,a0,-188 # ffffffffc0202bc0 <commands+0x528>
ffffffffc0200c84:	f28ff0ef          	jal	ra,ffffffffc02003ac <__panic>

ffffffffc0200c88 <buddy_check_0>:

static void buddy_check_0() {
ffffffffc0200c88:	7171                	addi	sp,sp,-176
ffffffffc0200c8a:	7379                	lui	t1,0xffffe
ffffffffc0200c8c:	f506                	sd	ra,168(sp)
ffffffffc0200c8e:	f122                	sd	s0,160(sp)
ffffffffc0200c90:	ed26                	sd	s1,152(sp)
ffffffffc0200c92:	e94a                	sd	s2,144(sp)
ffffffffc0200c94:	e54e                	sd	s3,136(sp)
ffffffffc0200c96:	e152                	sd	s4,128(sp)
ffffffffc0200c98:	fcd6                	sd	s5,120(sp)
ffffffffc0200c9a:	f8da                	sd	s6,112(sp)
ffffffffc0200c9c:	f4de                	sd	s7,104(sp)

#define ALLOC_PAGE_NUM 1036

    cprintf("[buddy_check_0] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
ffffffffc0200c9e:	00002517          	auipc	a0,0x2
ffffffffc0200ca2:	faa50513          	addi	a0,a0,-86 # ffffffffc0202c48 <commands+0x5b0>
static void buddy_check_0() {
ffffffffc0200ca6:	911a                	add	sp,sp,t1
    cprintf("[buddy_check_0] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
ffffffffc0200ca8:	c0aff0ef          	jal	ra,ffffffffc02000b2 <cprintf>

    size_t initial_nr_free_pages = nr_free_pages();
ffffffffc0200cac:	590000ef          	jal	ra,ffffffffc020123c <nr_free_pages>
ffffffffc0200cb0:	8a2a                	mv	s4,a0

    cprintf("[buddy_check_0] before alloc: ");
ffffffffc0200cb2:	00002517          	auipc	a0,0x2
ffffffffc0200cb6:	fde50513          	addi	a0,a0,-34 # ffffffffc0202c90 <commands+0x5f8>
ffffffffc0200cba:	bf8ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("[dbg_buddy] block: ");
ffffffffc0200cbe:	00002517          	auipc	a0,0x2
ffffffffc0200cc2:	ff250513          	addi	a0,a0,-14 # ffffffffc0202cb0 <commands+0x618>
ffffffffc0200cc6:	00006917          	auipc	s2,0x6
ffffffffc0200cca:	44a90913          	addi	s2,s2,1098 # ffffffffc0207110 <buddy_zone+0x100>
ffffffffc0200cce:	be4ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0200cd2:	84ca                	mv	s1,s2
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200cd4:	4429                	li	s0,10
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200cd6:	00002a97          	auipc	s5,0x2
ffffffffc0200cda:	ff2a8a93          	addi	s5,s5,-14 # ffffffffc0202cc8 <commands+0x630>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200cde:	59fd                	li	s3,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200ce0:	408c                	lw	a1,0(s1)
ffffffffc0200ce2:	8556                	mv	a0,s5
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200ce4:	14a1                	addi	s1,s1,-24
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200ce6:	0085d5bb          	srlw	a1,a1,s0
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200cea:	347d                	addiw	s0,s0,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200cec:	bc6ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200cf0:	ff3418e3          	bne	s0,s3,ffffffffc0200ce0 <buddy_check_0+0x58>
    cprintf("\n");
ffffffffc0200cf4:	00003517          	auipc	a0,0x3
ffffffffc0200cf8:	81c50513          	addi	a0,a0,-2020 # ffffffffc0203510 <buddy_pmm_manager+0x4f0>
ffffffffc0200cfc:	bb6ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    dbg_buddy();


    cprintf("[buddy_check_0] trying to alloc %d * 1 pages\n", ALLOC_PAGE_NUM);
ffffffffc0200d00:	40c00593          	li	a1,1036
ffffffffc0200d04:	00002517          	auipc	a0,0x2
ffffffffc0200d08:	fcc50513          	addi	a0,a0,-52 # ffffffffc0202cd0 <commands+0x638>
ffffffffc0200d0c:	ba6ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>

    struct Page *pages[ALLOC_PAGE_NUM];

    for (int i = 0; i < ALLOC_PAGE_NUM; i++) {
ffffffffc0200d10:	6709                	lui	a4,0x2
ffffffffc0200d12:	7479                	lui	s0,0xffffe
ffffffffc0200d14:	06070793          	addi	a5,a4,96 # 2060 <kern_entry-0xffffffffc01fdfa0>
ffffffffc0200d18:	978a                	add	a5,a5,sp
ffffffffc0200d1a:	fa040413          	addi	s0,s0,-96 # ffffffffffffdfa0 <end+0x3fdf69f0>
ffffffffc0200d1e:	943e                	add	s0,s0,a5
ffffffffc0200d20:	8bbe                	mv	s7,a5
    cprintf("[buddy_check_0] trying to alloc %d * 1 pages\n", ALLOC_PAGE_NUM);
ffffffffc0200d22:	84a2                	mv	s1,s0
        pages[i] = alloc_pages(1);
ffffffffc0200d24:	4505                	li	a0,1
ffffffffc0200d26:	498000ef          	jal	ra,ffffffffc02011be <alloc_pages>
ffffffffc0200d2a:	e088                	sd	a0,0(s1)
        assert(pages[i] != NULL);
ffffffffc0200d2c:	0e050263          	beqz	a0,ffffffffc0200e10 <buddy_check_0+0x188>
    for (int i = 0; i < ALLOC_PAGE_NUM; i++) {
ffffffffc0200d30:	04a1                	addi	s1,s1,8
ffffffffc0200d32:	ff7499e3          	bne	s1,s7,ffffffffc0200d24 <buddy_check_0+0x9c>
    }

    assert(nr_free_pages() == initial_nr_free_pages - ALLOC_PAGE_NUM);
ffffffffc0200d36:	506000ef          	jal	ra,ffffffffc020123c <nr_free_pages>
ffffffffc0200d3a:	bf4a0793          	addi	a5,s4,-1036
ffffffffc0200d3e:	10f51963          	bne	a0,a5,ffffffffc0200e50 <buddy_check_0+0x1c8>

    cprintf("[buddy_check_0] after alloc:  ");
ffffffffc0200d42:	00002517          	auipc	a0,0x2
ffffffffc0200d46:	01650513          	addi	a0,a0,22 # ffffffffc0202d58 <commands+0x6c0>
ffffffffc0200d4a:	b68ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("[dbg_buddy] block: ");
ffffffffc0200d4e:	00002517          	auipc	a0,0x2
ffffffffc0200d52:	f6250513          	addi	a0,a0,-158 # ffffffffc0202cb0 <commands+0x618>
ffffffffc0200d56:	b5cff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0200d5a:	00006997          	auipc	s3,0x6
ffffffffc0200d5e:	3b698993          	addi	s3,s3,950 # ffffffffc0207110 <buddy_zone+0x100>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200d62:	44a9                	li	s1,10
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200d64:	00002b17          	auipc	s6,0x2
ffffffffc0200d68:	f64b0b13          	addi	s6,s6,-156 # ffffffffc0202cc8 <commands+0x630>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200d6c:	5afd                	li	s5,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200d6e:	0009a583          	lw	a1,0(s3)
ffffffffc0200d72:	855a                	mv	a0,s6
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200d74:	19a1                	addi	s3,s3,-24
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200d76:	0095d5bb          	srlw	a1,a1,s1
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200d7a:	34fd                	addiw	s1,s1,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200d7c:	b36ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200d80:	ff5497e3          	bne	s1,s5,ffffffffc0200d6e <buddy_check_0+0xe6>
    cprintf("\n");
ffffffffc0200d84:	00002517          	auipc	a0,0x2
ffffffffc0200d88:	78c50513          	addi	a0,a0,1932 # ffffffffc0203510 <buddy_pmm_manager+0x4f0>
ffffffffc0200d8c:	b26ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    dbg_buddy();

    for (int i = 0; i < ALLOC_PAGE_NUM; i++) {
        free_pages(pages[i], 1);
ffffffffc0200d90:	6008                	ld	a0,0(s0)
ffffffffc0200d92:	4585                	li	a1,1
    for (int i = 0; i < ALLOC_PAGE_NUM; i++) {
ffffffffc0200d94:	0421                	addi	s0,s0,8
        free_pages(pages[i], 1);
ffffffffc0200d96:	466000ef          	jal	ra,ffffffffc02011fc <free_pages>
    for (int i = 0; i < ALLOC_PAGE_NUM; i++) {
ffffffffc0200d9a:	ff741be3          	bne	s0,s7,ffffffffc0200d90 <buddy_check_0+0x108>
    }

    assert(nr_free_pages() == initial_nr_free_pages);
ffffffffc0200d9e:	49e000ef          	jal	ra,ffffffffc020123c <nr_free_pages>
ffffffffc0200da2:	09451763          	bne	a0,s4,ffffffffc0200e30 <buddy_check_0+0x1a8>

    cprintf("[buddy_check_0] after free:   ");
ffffffffc0200da6:	00002517          	auipc	a0,0x2
ffffffffc0200daa:	00250513          	addi	a0,a0,2 # ffffffffc0202da8 <commands+0x710>
ffffffffc0200dae:	b04ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("[dbg_buddy] block: ");
ffffffffc0200db2:	00002517          	auipc	a0,0x2
ffffffffc0200db6:	efe50513          	addi	a0,a0,-258 # ffffffffc0202cb0 <commands+0x618>
ffffffffc0200dba:	af8ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200dbe:	4429                	li	s0,10
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200dc0:	00002997          	auipc	s3,0x2
ffffffffc0200dc4:	f0898993          	addi	s3,s3,-248 # ffffffffc0202cc8 <commands+0x630>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200dc8:	54fd                	li	s1,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200dca:	00092583          	lw	a1,0(s2)
ffffffffc0200dce:	854e                	mv	a0,s3
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200dd0:	1921                	addi	s2,s2,-24
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200dd2:	0085d5bb          	srlw	a1,a1,s0
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200dd6:	347d                	addiw	s0,s0,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200dd8:	adaff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200ddc:	fe9417e3          	bne	s0,s1,ffffffffc0200dca <buddy_check_0+0x142>
    cprintf("\n");
ffffffffc0200de0:	00002517          	auipc	a0,0x2
ffffffffc0200de4:	73050513          	addi	a0,a0,1840 # ffffffffc0203510 <buddy_pmm_manager+0x4f0>
ffffffffc0200de8:	acaff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    dbg_buddy();

    cprintf("[buddy_check_0] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");       
}
ffffffffc0200dec:	6309                	lui	t1,0x2
ffffffffc0200dee:	911a                	add	sp,sp,t1
ffffffffc0200df0:	70aa                	ld	ra,168(sp)
ffffffffc0200df2:	740a                	ld	s0,160(sp)
ffffffffc0200df4:	64ea                	ld	s1,152(sp)
ffffffffc0200df6:	694a                	ld	s2,144(sp)
ffffffffc0200df8:	69aa                	ld	s3,136(sp)
ffffffffc0200dfa:	6a0a                	ld	s4,128(sp)
ffffffffc0200dfc:	7ae6                	ld	s5,120(sp)
ffffffffc0200dfe:	7b46                	ld	s6,112(sp)
ffffffffc0200e00:	7ba6                	ld	s7,104(sp)
    cprintf("[buddy_check_0] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");       
ffffffffc0200e02:	00002517          	auipc	a0,0x2
ffffffffc0200e06:	fc650513          	addi	a0,a0,-58 # ffffffffc0202dc8 <commands+0x730>
}
ffffffffc0200e0a:	614d                	addi	sp,sp,176
    cprintf("[buddy_check_0] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");       
ffffffffc0200e0c:	aa6ff06f          	j	ffffffffc02000b2 <cprintf>
        assert(pages[i] != NULL);
ffffffffc0200e10:	00002697          	auipc	a3,0x2
ffffffffc0200e14:	ef068693          	addi	a3,a3,-272 # ffffffffc0202d00 <commands+0x668>
ffffffffc0200e18:	00002617          	auipc	a2,0x2
ffffffffc0200e1c:	d9060613          	addi	a2,a2,-624 # ffffffffc0202ba8 <commands+0x510>
ffffffffc0200e20:	12400593          	li	a1,292
ffffffffc0200e24:	00002517          	auipc	a0,0x2
ffffffffc0200e28:	d9c50513          	addi	a0,a0,-612 # ffffffffc0202bc0 <commands+0x528>
ffffffffc0200e2c:	d80ff0ef          	jal	ra,ffffffffc02003ac <__panic>
    assert(nr_free_pages() == initial_nr_free_pages);
ffffffffc0200e30:	00002697          	auipc	a3,0x2
ffffffffc0200e34:	f4868693          	addi	a3,a3,-184 # ffffffffc0202d78 <commands+0x6e0>
ffffffffc0200e38:	00002617          	auipc	a2,0x2
ffffffffc0200e3c:	d7060613          	addi	a2,a2,-656 # ffffffffc0202ba8 <commands+0x510>
ffffffffc0200e40:	13000593          	li	a1,304
ffffffffc0200e44:	00002517          	auipc	a0,0x2
ffffffffc0200e48:	d7c50513          	addi	a0,a0,-644 # ffffffffc0202bc0 <commands+0x528>
ffffffffc0200e4c:	d60ff0ef          	jal	ra,ffffffffc02003ac <__panic>
    assert(nr_free_pages() == initial_nr_free_pages - ALLOC_PAGE_NUM);
ffffffffc0200e50:	00002697          	auipc	a3,0x2
ffffffffc0200e54:	ec868693          	addi	a3,a3,-312 # ffffffffc0202d18 <commands+0x680>
ffffffffc0200e58:	00002617          	auipc	a2,0x2
ffffffffc0200e5c:	d5060613          	addi	a2,a2,-688 # ffffffffc0202ba8 <commands+0x510>
ffffffffc0200e60:	12700593          	li	a1,295
ffffffffc0200e64:	00002517          	auipc	a0,0x2
ffffffffc0200e68:	d5c50513          	addi	a0,a0,-676 # ffffffffc0202bc0 <commands+0x528>
ffffffffc0200e6c:	d40ff0ef          	jal	ra,ffffffffc02003ac <__panic>

ffffffffc0200e70 <buddy_check>:
    dbg_buddy();

    cprintf("[buddy_check_1] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
}

static void buddy_check(void) {
ffffffffc0200e70:	715d                	addi	sp,sp,-80
ffffffffc0200e72:	e486                	sd	ra,72(sp)
ffffffffc0200e74:	e0a2                	sd	s0,64(sp)
ffffffffc0200e76:	fc26                	sd	s1,56(sp)
ffffffffc0200e78:	f84a                	sd	s2,48(sp)
ffffffffc0200e7a:	f44e                	sd	s3,40(sp)
ffffffffc0200e7c:	f052                	sd	s4,32(sp)
ffffffffc0200e7e:	ec56                	sd	s5,24(sp)
ffffffffc0200e80:	e85a                	sd	s6,16(sp)
ffffffffc0200e82:	e45e                	sd	s7,8(sp)
ffffffffc0200e84:	e062                	sd	s8,0(sp)
    buddy_check_0();
ffffffffc0200e86:	e03ff0ef          	jal	ra,ffffffffc0200c88 <buddy_check_0>
    cprintf("[buddy_check_1] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
ffffffffc0200e8a:	00002517          	auipc	a0,0x2
ffffffffc0200e8e:	f8650513          	addi	a0,a0,-122 # ffffffffc0202e10 <commands+0x778>
ffffffffc0200e92:	a20ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    struct Page* p0 = alloc_pages(512);
ffffffffc0200e96:	20000513          	li	a0,512
ffffffffc0200e9a:	324000ef          	jal	ra,ffffffffc02011be <alloc_pages>
    assert(p0 != NULL);
ffffffffc0200e9e:	22050063          	beqz	a0,ffffffffc02010be <buddy_check+0x24e>
    assert(p0->property == 512);
ffffffffc0200ea2:	4918                	lw	a4,16(a0)
ffffffffc0200ea4:	20000793          	li	a5,512
ffffffffc0200ea8:	89aa                	mv	s3,a0
ffffffffc0200eaa:	2ef71a63          	bne	a4,a5,ffffffffc020119e <buddy_check+0x32e>
    cprintf("[buddy_check_1] after alloc 512 pages: ");
ffffffffc0200eae:	00002517          	auipc	a0,0x2
ffffffffc0200eb2:	fd250513          	addi	a0,a0,-46 # ffffffffc0202e80 <commands+0x7e8>
ffffffffc0200eb6:	9fcff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("[dbg_buddy] block: ");
ffffffffc0200eba:	00002517          	auipc	a0,0x2
ffffffffc0200ebe:	df650513          	addi	a0,a0,-522 # ffffffffc0202cb0 <commands+0x618>
ffffffffc0200ec2:	00006497          	auipc	s1,0x6
ffffffffc0200ec6:	24e48493          	addi	s1,s1,590 # ffffffffc0207110 <buddy_zone+0x100>
ffffffffc0200eca:	9e8ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0200ece:	8926                	mv	s2,s1
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200ed0:	4429                	li	s0,10
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200ed2:	00002a97          	auipc	s5,0x2
ffffffffc0200ed6:	df6a8a93          	addi	s5,s5,-522 # ffffffffc0202cc8 <commands+0x630>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200eda:	5a7d                	li	s4,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200edc:	00092583          	lw	a1,0(s2)
ffffffffc0200ee0:	8556                	mv	a0,s5
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200ee2:	1921                	addi	s2,s2,-24
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200ee4:	0085d5bb          	srlw	a1,a1,s0
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200ee8:	347d                	addiw	s0,s0,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200eea:	9c8ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200eee:	ff4417e3          	bne	s0,s4,ffffffffc0200edc <buddy_check+0x6c>
    cprintf("\n");
ffffffffc0200ef2:	00002517          	auipc	a0,0x2
ffffffffc0200ef6:	61e50513          	addi	a0,a0,1566 # ffffffffc0203510 <buddy_pmm_manager+0x4f0>
ffffffffc0200efa:	9b8ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    struct Page* p1 = alloc_pages(513);
ffffffffc0200efe:	20100513          	li	a0,513
ffffffffc0200f02:	2bc000ef          	jal	ra,ffffffffc02011be <alloc_pages>
ffffffffc0200f06:	8a2a                	mv	s4,a0
    assert(p1 != NULL);
ffffffffc0200f08:	26050b63          	beqz	a0,ffffffffc020117e <buddy_check+0x30e>
    assert(p1->property == 1024);
ffffffffc0200f0c:	4918                	lw	a4,16(a0)
ffffffffc0200f0e:	40000793          	li	a5,1024
ffffffffc0200f12:	24f71663          	bne	a4,a5,ffffffffc020115e <buddy_check+0x2ee>
    cprintf("[buddy_check_1] after alloc 513 pages: ");
ffffffffc0200f16:	00002517          	auipc	a0,0x2
ffffffffc0200f1a:	fba50513          	addi	a0,a0,-70 # ffffffffc0202ed0 <commands+0x838>
ffffffffc0200f1e:	994ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("[dbg_buddy] block: ");
ffffffffc0200f22:	00002517          	auipc	a0,0x2
ffffffffc0200f26:	d8e50513          	addi	a0,a0,-626 # ffffffffc0202cb0 <commands+0x618>
ffffffffc0200f2a:	988ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0200f2e:	00006917          	auipc	s2,0x6
ffffffffc0200f32:	1e290913          	addi	s2,s2,482 # ffffffffc0207110 <buddy_zone+0x100>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200f36:	4429                	li	s0,10
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200f38:	00002b17          	auipc	s6,0x2
ffffffffc0200f3c:	d90b0b13          	addi	s6,s6,-624 # ffffffffc0202cc8 <commands+0x630>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200f40:	5afd                	li	s5,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200f42:	00092583          	lw	a1,0(s2)
ffffffffc0200f46:	855a                	mv	a0,s6
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200f48:	1921                	addi	s2,s2,-24
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200f4a:	0085d5bb          	srlw	a1,a1,s0
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200f4e:	347d                	addiw	s0,s0,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200f50:	962ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200f54:	ff5417e3          	bne	s0,s5,ffffffffc0200f42 <buddy_check+0xd2>
    cprintf("\n");
ffffffffc0200f58:	00002517          	auipc	a0,0x2
ffffffffc0200f5c:	5b850513          	addi	a0,a0,1464 # ffffffffc0203510 <buddy_pmm_manager+0x4f0>
ffffffffc0200f60:	952ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    struct Page* p2 = alloc_pages(79);
ffffffffc0200f64:	04f00513          	li	a0,79
ffffffffc0200f68:	256000ef          	jal	ra,ffffffffc02011be <alloc_pages>
ffffffffc0200f6c:	8baa                	mv	s7,a0
    assert(p2 != NULL);
ffffffffc0200f6e:	1c050863          	beqz	a0,ffffffffc020113e <buddy_check+0x2ce>
    assert(p2->property == 128);
ffffffffc0200f72:	4918                	lw	a4,16(a0)
ffffffffc0200f74:	08000793          	li	a5,128
ffffffffc0200f78:	1af71363          	bne	a4,a5,ffffffffc020111e <buddy_check+0x2ae>
    cprintf("[buddy_check_1] after alloc 79 pages:  ");
ffffffffc0200f7c:	00002517          	auipc	a0,0x2
ffffffffc0200f80:	fa450513          	addi	a0,a0,-92 # ffffffffc0202f20 <commands+0x888>
ffffffffc0200f84:	92eff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("[dbg_buddy] block: ");
ffffffffc0200f88:	00002517          	auipc	a0,0x2
ffffffffc0200f8c:	d2850513          	addi	a0,a0,-728 # ffffffffc0202cb0 <commands+0x618>
ffffffffc0200f90:	922ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0200f94:	00006917          	auipc	s2,0x6
ffffffffc0200f98:	17c90913          	addi	s2,s2,380 # ffffffffc0207110 <buddy_zone+0x100>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200f9c:	4429                	li	s0,10
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200f9e:	00002b17          	auipc	s6,0x2
ffffffffc0200fa2:	d2ab0b13          	addi	s6,s6,-726 # ffffffffc0202cc8 <commands+0x630>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200fa6:	5afd                	li	s5,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200fa8:	00092583          	lw	a1,0(s2)
ffffffffc0200fac:	855a                	mv	a0,s6
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200fae:	1921                	addi	s2,s2,-24
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200fb0:	0085d5bb          	srlw	a1,a1,s0
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200fb4:	347d                	addiw	s0,s0,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0200fb6:	8fcff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0200fba:	ff5417e3          	bne	s0,s5,ffffffffc0200fa8 <buddy_check+0x138>
    cprintf("\n");
ffffffffc0200fbe:	00002517          	auipc	a0,0x2
ffffffffc0200fc2:	55250513          	addi	a0,a0,1362 # ffffffffc0203510 <buddy_pmm_manager+0x4f0>
ffffffffc0200fc6:	8ecff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    struct Page* p3 = alloc_pages(37);
ffffffffc0200fca:	02500513          	li	a0,37
ffffffffc0200fce:	1f0000ef          	jal	ra,ffffffffc02011be <alloc_pages>
ffffffffc0200fd2:	8c2a                	mv	s8,a0
    assert(p3 != NULL);
ffffffffc0200fd4:	12050563          	beqz	a0,ffffffffc02010fe <buddy_check+0x28e>
    assert(p3->property == 64);
ffffffffc0200fd8:	4918                	lw	a4,16(a0)
ffffffffc0200fda:	04000793          	li	a5,64
ffffffffc0200fde:	10f71063          	bne	a4,a5,ffffffffc02010de <buddy_check+0x26e>
    cprintf("[buddy_check_1] after alloc 37 pages:  ");
ffffffffc0200fe2:	00002517          	auipc	a0,0x2
ffffffffc0200fe6:	f8e50513          	addi	a0,a0,-114 # ffffffffc0202f70 <commands+0x8d8>
ffffffffc0200fea:	8c8ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("[dbg_buddy] block: ");
ffffffffc0200fee:	00002517          	auipc	a0,0x2
ffffffffc0200ff2:	cc250513          	addi	a0,a0,-830 # ffffffffc0202cb0 <commands+0x618>
ffffffffc0200ff6:	8bcff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0200ffa:	00006917          	auipc	s2,0x6
ffffffffc0200ffe:	11690913          	addi	s2,s2,278 # ffffffffc0207110 <buddy_zone+0x100>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0201002:	4429                	li	s0,10
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0201004:	00002b17          	auipc	s6,0x2
ffffffffc0201008:	cc4b0b13          	addi	s6,s6,-828 # ffffffffc0202cc8 <commands+0x630>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc020100c:	5afd                	li	s5,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc020100e:	00092583          	lw	a1,0(s2)
ffffffffc0201012:	855a                	mv	a0,s6
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0201014:	1921                	addi	s2,s2,-24
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0201016:	0085d5bb          	srlw	a1,a1,s0
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc020101a:	347d                	addiw	s0,s0,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc020101c:	896ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0201020:	ff5417e3          	bne	s0,s5,ffffffffc020100e <buddy_check+0x19e>
    cprintf("\n");
ffffffffc0201024:	00002517          	auipc	a0,0x2
ffffffffc0201028:	4ec50513          	addi	a0,a0,1260 # ffffffffc0203510 <buddy_pmm_manager+0x4f0>
ffffffffc020102c:	886ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    free_pages(p0, 512);
ffffffffc0201030:	854e                	mv	a0,s3
ffffffffc0201032:	20000593          	li	a1,512
ffffffffc0201036:	1c6000ef          	jal	ra,ffffffffc02011fc <free_pages>
    free_pages(p2, 79);
ffffffffc020103a:	04f00593          	li	a1,79
ffffffffc020103e:	855e                	mv	a0,s7
ffffffffc0201040:	1bc000ef          	jal	ra,ffffffffc02011fc <free_pages>
    free_pages(p3, 37);
ffffffffc0201044:	02500593          	li	a1,37
ffffffffc0201048:	8562                	mv	a0,s8
ffffffffc020104a:	1b2000ef          	jal	ra,ffffffffc02011fc <free_pages>
    free_pages(p1, 513);
ffffffffc020104e:	20100593          	li	a1,513
ffffffffc0201052:	8552                	mv	a0,s4
ffffffffc0201054:	1a8000ef          	jal	ra,ffffffffc02011fc <free_pages>
    cprintf("[buddy_check_1] after free:            ");
ffffffffc0201058:	00002517          	auipc	a0,0x2
ffffffffc020105c:	f4050513          	addi	a0,a0,-192 # ffffffffc0202f98 <commands+0x900>
ffffffffc0201060:	852ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("[dbg_buddy] block: ");
ffffffffc0201064:	00002517          	auipc	a0,0x2
ffffffffc0201068:	c4c50513          	addi	a0,a0,-948 # ffffffffc0202cb0 <commands+0x618>
ffffffffc020106c:	846ff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0201070:	4429                	li	s0,10
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0201072:	00002997          	auipc	s3,0x2
ffffffffc0201076:	c5698993          	addi	s3,s3,-938 # ffffffffc0202cc8 <commands+0x630>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc020107a:	597d                	li	s2,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc020107c:	408c                	lw	a1,0(s1)
ffffffffc020107e:	854e                	mv	a0,s3
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0201080:	14a1                	addi	s1,s1,-24
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0201082:	0085d5bb          	srlw	a1,a1,s0
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc0201086:	347d                	addiw	s0,s0,-1
        cprintf("%2d ", buddy_zone.free_area[order].nr_free / (1 << order));
ffffffffc0201088:	82aff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int order = BUDDY_MAX_ORDER - 1; order >= 0; order--) {
ffffffffc020108c:	ff2418e3          	bne	s0,s2,ffffffffc020107c <buddy_check+0x20c>
    cprintf("\n");
ffffffffc0201090:	00002517          	auipc	a0,0x2
ffffffffc0201094:	48050513          	addi	a0,a0,1152 # ffffffffc0203510 <buddy_pmm_manager+0x4f0>
ffffffffc0201098:	81aff0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    buddy_check_1();
}
ffffffffc020109c:	6406                	ld	s0,64(sp)
ffffffffc020109e:	60a6                	ld	ra,72(sp)
ffffffffc02010a0:	74e2                	ld	s1,56(sp)
ffffffffc02010a2:	7942                	ld	s2,48(sp)
ffffffffc02010a4:	79a2                	ld	s3,40(sp)
ffffffffc02010a6:	7a02                	ld	s4,32(sp)
ffffffffc02010a8:	6ae2                	ld	s5,24(sp)
ffffffffc02010aa:	6b42                	ld	s6,16(sp)
ffffffffc02010ac:	6ba2                	ld	s7,8(sp)
ffffffffc02010ae:	6c02                	ld	s8,0(sp)
    cprintf("[buddy_check_1] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
ffffffffc02010b0:	00002517          	auipc	a0,0x2
ffffffffc02010b4:	f1050513          	addi	a0,a0,-240 # ffffffffc0202fc0 <commands+0x928>
}
ffffffffc02010b8:	6161                	addi	sp,sp,80
    cprintf("[buddy_check_1] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
ffffffffc02010ba:	ff9fe06f          	j	ffffffffc02000b2 <cprintf>
    assert(p0 != NULL);
ffffffffc02010be:	00002697          	auipc	a3,0x2
ffffffffc02010c2:	d9a68693          	addi	a3,a3,-614 # ffffffffc0202e58 <commands+0x7c0>
ffffffffc02010c6:	00002617          	auipc	a2,0x2
ffffffffc02010ca:	ae260613          	addi	a2,a2,-1310 # ffffffffc0202ba8 <commands+0x510>
ffffffffc02010ce:	13d00593          	li	a1,317
ffffffffc02010d2:	00002517          	auipc	a0,0x2
ffffffffc02010d6:	aee50513          	addi	a0,a0,-1298 # ffffffffc0202bc0 <commands+0x528>
ffffffffc02010da:	ad2ff0ef          	jal	ra,ffffffffc02003ac <__panic>
    assert(p3->property == 64);
ffffffffc02010de:	00002697          	auipc	a3,0x2
ffffffffc02010e2:	e7a68693          	addi	a3,a3,-390 # ffffffffc0202f58 <commands+0x8c0>
ffffffffc02010e6:	00002617          	auipc	a2,0x2
ffffffffc02010ea:	ac260613          	addi	a2,a2,-1342 # ffffffffc0202ba8 <commands+0x510>
ffffffffc02010ee:	15600593          	li	a1,342
ffffffffc02010f2:	00002517          	auipc	a0,0x2
ffffffffc02010f6:	ace50513          	addi	a0,a0,-1330 # ffffffffc0202bc0 <commands+0x528>
ffffffffc02010fa:	ab2ff0ef          	jal	ra,ffffffffc02003ac <__panic>
    assert(p3 != NULL);
ffffffffc02010fe:	00002697          	auipc	a3,0x2
ffffffffc0201102:	e4a68693          	addi	a3,a3,-438 # ffffffffc0202f48 <commands+0x8b0>
ffffffffc0201106:	00002617          	auipc	a2,0x2
ffffffffc020110a:	aa260613          	addi	a2,a2,-1374 # ffffffffc0202ba8 <commands+0x510>
ffffffffc020110e:	15500593          	li	a1,341
ffffffffc0201112:	00002517          	auipc	a0,0x2
ffffffffc0201116:	aae50513          	addi	a0,a0,-1362 # ffffffffc0202bc0 <commands+0x528>
ffffffffc020111a:	a92ff0ef          	jal	ra,ffffffffc02003ac <__panic>
    assert(p2->property == 128);
ffffffffc020111e:	00002697          	auipc	a3,0x2
ffffffffc0201122:	dea68693          	addi	a3,a3,-534 # ffffffffc0202f08 <commands+0x870>
ffffffffc0201126:	00002617          	auipc	a2,0x2
ffffffffc020112a:	a8260613          	addi	a2,a2,-1406 # ffffffffc0202ba8 <commands+0x510>
ffffffffc020112e:	14e00593          	li	a1,334
ffffffffc0201132:	00002517          	auipc	a0,0x2
ffffffffc0201136:	a8e50513          	addi	a0,a0,-1394 # ffffffffc0202bc0 <commands+0x528>
ffffffffc020113a:	a72ff0ef          	jal	ra,ffffffffc02003ac <__panic>
    assert(p2 != NULL);
ffffffffc020113e:	00002697          	auipc	a3,0x2
ffffffffc0201142:	dba68693          	addi	a3,a3,-582 # ffffffffc0202ef8 <commands+0x860>
ffffffffc0201146:	00002617          	auipc	a2,0x2
ffffffffc020114a:	a6260613          	addi	a2,a2,-1438 # ffffffffc0202ba8 <commands+0x510>
ffffffffc020114e:	14d00593          	li	a1,333
ffffffffc0201152:	00002517          	auipc	a0,0x2
ffffffffc0201156:	a6e50513          	addi	a0,a0,-1426 # ffffffffc0202bc0 <commands+0x528>
ffffffffc020115a:	a52ff0ef          	jal	ra,ffffffffc02003ac <__panic>
    assert(p1->property == 1024);
ffffffffc020115e:	00002697          	auipc	a3,0x2
ffffffffc0201162:	d5a68693          	addi	a3,a3,-678 # ffffffffc0202eb8 <commands+0x820>
ffffffffc0201166:	00002617          	auipc	a2,0x2
ffffffffc020116a:	a4260613          	addi	a2,a2,-1470 # ffffffffc0202ba8 <commands+0x510>
ffffffffc020116e:	14600593          	li	a1,326
ffffffffc0201172:	00002517          	auipc	a0,0x2
ffffffffc0201176:	a4e50513          	addi	a0,a0,-1458 # ffffffffc0202bc0 <commands+0x528>
ffffffffc020117a:	a32ff0ef          	jal	ra,ffffffffc02003ac <__panic>
    assert(p1 != NULL);
ffffffffc020117e:	00002697          	auipc	a3,0x2
ffffffffc0201182:	d2a68693          	addi	a3,a3,-726 # ffffffffc0202ea8 <commands+0x810>
ffffffffc0201186:	00002617          	auipc	a2,0x2
ffffffffc020118a:	a2260613          	addi	a2,a2,-1502 # ffffffffc0202ba8 <commands+0x510>
ffffffffc020118e:	14500593          	li	a1,325
ffffffffc0201192:	00002517          	auipc	a0,0x2
ffffffffc0201196:	a2e50513          	addi	a0,a0,-1490 # ffffffffc0202bc0 <commands+0x528>
ffffffffc020119a:	a12ff0ef          	jal	ra,ffffffffc02003ac <__panic>
    assert(p0->property == 512);
ffffffffc020119e:	00002697          	auipc	a3,0x2
ffffffffc02011a2:	cca68693          	addi	a3,a3,-822 # ffffffffc0202e68 <commands+0x7d0>
ffffffffc02011a6:	00002617          	auipc	a2,0x2
ffffffffc02011aa:	a0260613          	addi	a2,a2,-1534 # ffffffffc0202ba8 <commands+0x510>
ffffffffc02011ae:	13e00593          	li	a1,318
ffffffffc02011b2:	00002517          	auipc	a0,0x2
ffffffffc02011b6:	a0e50513          	addi	a0,a0,-1522 # ffffffffc0202bc0 <commands+0x528>
ffffffffc02011ba:	9f2ff0ef          	jal	ra,ffffffffc02003ac <__panic>

ffffffffc02011be <alloc_pages>:
#include <defs.h>
#include <intr.h>
#include <riscv.h>

static inline bool __intr_save(void) {
    if (read_csr(sstatus) & SSTATUS_SIE) {
ffffffffc02011be:	100027f3          	csrr	a5,sstatus
ffffffffc02011c2:	8b89                	andi	a5,a5,2
ffffffffc02011c4:	e799                	bnez	a5,ffffffffc02011d2 <alloc_pages+0x14>
struct Page *alloc_pages(size_t n) {
    struct Page *page = NULL;
    bool intr_flag;
    local_intr_save(intr_flag);
    {
        page = pmm_manager->alloc_pages(n);
ffffffffc02011c6:	00006797          	auipc	a5,0x6
ffffffffc02011ca:	3c27b783          	ld	a5,962(a5) # ffffffffc0207588 <pmm_manager>
ffffffffc02011ce:	6f9c                	ld	a5,24(a5)
ffffffffc02011d0:	8782                	jr	a5
struct Page *alloc_pages(size_t n) {
ffffffffc02011d2:	1141                	addi	sp,sp,-16
ffffffffc02011d4:	e406                	sd	ra,8(sp)
ffffffffc02011d6:	e022                	sd	s0,0(sp)
ffffffffc02011d8:	842a                	mv	s0,a0
        intr_disable();
ffffffffc02011da:	a84ff0ef          	jal	ra,ffffffffc020045e <intr_disable>
        page = pmm_manager->alloc_pages(n);
ffffffffc02011de:	00006797          	auipc	a5,0x6
ffffffffc02011e2:	3aa7b783          	ld	a5,938(a5) # ffffffffc0207588 <pmm_manager>
ffffffffc02011e6:	6f9c                	ld	a5,24(a5)
ffffffffc02011e8:	8522                	mv	a0,s0
ffffffffc02011ea:	9782                	jalr	a5
ffffffffc02011ec:	842a                	mv	s0,a0
    return 0;
}

static inline void __intr_restore(bool flag) {
    if (flag) {
        intr_enable();
ffffffffc02011ee:	a6aff0ef          	jal	ra,ffffffffc0200458 <intr_enable>
    }
    local_intr_restore(intr_flag);
    return page;
}
ffffffffc02011f2:	60a2                	ld	ra,8(sp)
ffffffffc02011f4:	8522                	mv	a0,s0
ffffffffc02011f6:	6402                	ld	s0,0(sp)
ffffffffc02011f8:	0141                	addi	sp,sp,16
ffffffffc02011fa:	8082                	ret

ffffffffc02011fc <free_pages>:
    if (read_csr(sstatus) & SSTATUS_SIE) {
ffffffffc02011fc:	100027f3          	csrr	a5,sstatus
ffffffffc0201200:	8b89                	andi	a5,a5,2
ffffffffc0201202:	e799                	bnez	a5,ffffffffc0201210 <free_pages+0x14>
// free_pages - call pmm->free_pages to free a continuous n*PAGESIZE memory
void free_pages(struct Page *base, size_t n) {
    bool intr_flag;
    local_intr_save(intr_flag);
    {
        pmm_manager->free_pages(base, n);
ffffffffc0201204:	00006797          	auipc	a5,0x6
ffffffffc0201208:	3847b783          	ld	a5,900(a5) # ffffffffc0207588 <pmm_manager>
ffffffffc020120c:	739c                	ld	a5,32(a5)
ffffffffc020120e:	8782                	jr	a5
void free_pages(struct Page *base, size_t n) {
ffffffffc0201210:	1101                	addi	sp,sp,-32
ffffffffc0201212:	ec06                	sd	ra,24(sp)
ffffffffc0201214:	e822                	sd	s0,16(sp)
ffffffffc0201216:	e426                	sd	s1,8(sp)
ffffffffc0201218:	842a                	mv	s0,a0
ffffffffc020121a:	84ae                	mv	s1,a1
        intr_disable();
ffffffffc020121c:	a42ff0ef          	jal	ra,ffffffffc020045e <intr_disable>
        pmm_manager->free_pages(base, n);
ffffffffc0201220:	00006797          	auipc	a5,0x6
ffffffffc0201224:	3687b783          	ld	a5,872(a5) # ffffffffc0207588 <pmm_manager>
ffffffffc0201228:	739c                	ld	a5,32(a5)
ffffffffc020122a:	85a6                	mv	a1,s1
ffffffffc020122c:	8522                	mv	a0,s0
ffffffffc020122e:	9782                	jalr	a5
    }
    local_intr_restore(intr_flag);
}
ffffffffc0201230:	6442                	ld	s0,16(sp)
ffffffffc0201232:	60e2                	ld	ra,24(sp)
ffffffffc0201234:	64a2                	ld	s1,8(sp)
ffffffffc0201236:	6105                	addi	sp,sp,32
        intr_enable();
ffffffffc0201238:	a20ff06f          	j	ffffffffc0200458 <intr_enable>

ffffffffc020123c <nr_free_pages>:
    if (read_csr(sstatus) & SSTATUS_SIE) {
ffffffffc020123c:	100027f3          	csrr	a5,sstatus
ffffffffc0201240:	8b89                	andi	a5,a5,2
ffffffffc0201242:	e799                	bnez	a5,ffffffffc0201250 <nr_free_pages+0x14>
size_t nr_free_pages(void) {
    size_t ret;
    bool intr_flag;
    local_intr_save(intr_flag);
    {
        ret = pmm_manager->nr_free_pages();
ffffffffc0201244:	00006797          	auipc	a5,0x6
ffffffffc0201248:	3447b783          	ld	a5,836(a5) # ffffffffc0207588 <pmm_manager>
ffffffffc020124c:	779c                	ld	a5,40(a5)
ffffffffc020124e:	8782                	jr	a5
size_t nr_free_pages(void) {
ffffffffc0201250:	1141                	addi	sp,sp,-16
ffffffffc0201252:	e406                	sd	ra,8(sp)
ffffffffc0201254:	e022                	sd	s0,0(sp)
        intr_disable();
ffffffffc0201256:	a08ff0ef          	jal	ra,ffffffffc020045e <intr_disable>
        ret = pmm_manager->nr_free_pages();
ffffffffc020125a:	00006797          	auipc	a5,0x6
ffffffffc020125e:	32e7b783          	ld	a5,814(a5) # ffffffffc0207588 <pmm_manager>
ffffffffc0201262:	779c                	ld	a5,40(a5)
ffffffffc0201264:	9782                	jalr	a5
ffffffffc0201266:	842a                	mv	s0,a0
        intr_enable();
ffffffffc0201268:	9f0ff0ef          	jal	ra,ffffffffc0200458 <intr_enable>
    }
    local_intr_restore(intr_flag);
    return ret;
}
ffffffffc020126c:	60a2                	ld	ra,8(sp)
ffffffffc020126e:	8522                	mv	a0,s0
ffffffffc0201270:	6402                	ld	s0,0(sp)
ffffffffc0201272:	0141                	addi	sp,sp,16
ffffffffc0201274:	8082                	ret

ffffffffc0201276 <pmm_init>:
    pmm_manager = &slob_pmm_manager;
ffffffffc0201276:	00002797          	auipc	a5,0x2
ffffffffc020127a:	68a78793          	addi	a5,a5,1674 # ffffffffc0203900 <slob_pmm_manager>
    cprintf("memory management: %s\n", pmm_manager->name);
ffffffffc020127e:	638c                	ld	a1,0(a5)
        init_memmap(pa2page(mem_begin), (mem_end - mem_begin) / PGSIZE);
    }
}

/* pmm_init - initialize the physical memory management */
void pmm_init(void) {
ffffffffc0201280:	7139                	addi	sp,sp,-64
ffffffffc0201282:	f04a                	sd	s2,32(sp)
    cprintf("memory management: %s\n", pmm_manager->name);
ffffffffc0201284:	00002517          	auipc	a0,0x2
ffffffffc0201288:	de450513          	addi	a0,a0,-540 # ffffffffc0203068 <buddy_pmm_manager+0x48>
    pmm_manager = &slob_pmm_manager;
ffffffffc020128c:	00006917          	auipc	s2,0x6
ffffffffc0201290:	2fc90913          	addi	s2,s2,764 # ffffffffc0207588 <pmm_manager>
void pmm_init(void) {
ffffffffc0201294:	fc06                	sd	ra,56(sp)
ffffffffc0201296:	f822                	sd	s0,48(sp)
ffffffffc0201298:	f426                	sd	s1,40(sp)
ffffffffc020129a:	ec4e                	sd	s3,24(sp)
ffffffffc020129c:	e852                	sd	s4,16(sp)
    pmm_manager = &slob_pmm_manager;
ffffffffc020129e:	00f93023          	sd	a5,0(s2)
void pmm_init(void) {
ffffffffc02012a2:	e456                	sd	s5,8(sp)
ffffffffc02012a4:	e05a                	sd	s6,0(sp)
    cprintf("memory management: %s\n", pmm_manager->name);
ffffffffc02012a6:	e0dfe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    pmm_manager->init();
ffffffffc02012aa:	00093783          	ld	a5,0(s2)
    va_pa_offset = PHYSICAL_MEMORY_OFFSET;
ffffffffc02012ae:	00006497          	auipc	s1,0x6
ffffffffc02012b2:	2f248493          	addi	s1,s1,754 # ffffffffc02075a0 <va_pa_offset>
    cprintf("  memory: 0x%016lx, [0x%016lx, 0x%016lx].\n", mem_size, mem_begin,
ffffffffc02012b6:	4445                	li	s0,17
    pmm_manager->init();
ffffffffc02012b8:	679c                	ld	a5,8(a5)
    cprintf("  memory: 0x%016lx, [0x%016lx, 0x%016lx].\n", mem_size, mem_begin,
ffffffffc02012ba:	046e                	slli	s0,s0,0x1b
    npage = maxpa / PGSIZE;
ffffffffc02012bc:	00006997          	auipc	s3,0x6
ffffffffc02012c0:	2bc98993          	addi	s3,s3,700 # ffffffffc0207578 <npage>
    pmm_manager->init();
ffffffffc02012c4:	9782                	jalr	a5
    va_pa_offset = PHYSICAL_MEMORY_OFFSET;
ffffffffc02012c6:	57f5                	li	a5,-3
ffffffffc02012c8:	07fa                	slli	a5,a5,0x1e
    cprintf("physcial memory map:\n");
ffffffffc02012ca:	00002517          	auipc	a0,0x2
ffffffffc02012ce:	db650513          	addi	a0,a0,-586 # ffffffffc0203080 <buddy_pmm_manager+0x60>
    va_pa_offset = PHYSICAL_MEMORY_OFFSET;
ffffffffc02012d2:	e09c                	sd	a5,0(s1)
    cprintf("physcial memory map:\n");
ffffffffc02012d4:	ddffe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("  memory: 0x%016lx, [0x%016lx, 0x%016lx].\n", mem_size, mem_begin,
ffffffffc02012d8:	40100613          	li	a2,1025
ffffffffc02012dc:	0656                	slli	a2,a2,0x15
ffffffffc02012de:	fff40693          	addi	a3,s0,-1
ffffffffc02012e2:	07e005b7          	lui	a1,0x7e00
ffffffffc02012e6:	00002517          	auipc	a0,0x2
ffffffffc02012ea:	db250513          	addi	a0,a0,-590 # ffffffffc0203098 <buddy_pmm_manager+0x78>
ffffffffc02012ee:	dc5fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("maxpa: 0x%016lx\n", maxpa);
ffffffffc02012f2:	85a2                	mv	a1,s0
ffffffffc02012f4:	00002517          	auipc	a0,0x2
ffffffffc02012f8:	dd450513          	addi	a0,a0,-556 # ffffffffc02030c8 <buddy_pmm_manager+0xa8>
ffffffffc02012fc:	db7fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    npage = maxpa / PGSIZE;
ffffffffc0201300:	000887b7          	lui	a5,0x88
    cprintf("npage: 0x%x\n", npage);
ffffffffc0201304:	000885b7          	lui	a1,0x88
ffffffffc0201308:	00002517          	auipc	a0,0x2
ffffffffc020130c:	dd850513          	addi	a0,a0,-552 # ffffffffc02030e0 <buddy_pmm_manager+0xc0>
    npage = maxpa / PGSIZE;
ffffffffc0201310:	00f9b023          	sd	a5,0(s3)
    cprintf("npage: 0x%x\n", npage);
ffffffffc0201314:	d9ffe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("nbase: 0x%x\n", nbase);
ffffffffc0201318:	000805b7          	lui	a1,0x80
ffffffffc020131c:	00002517          	auipc	a0,0x2
ffffffffc0201320:	dd450513          	addi	a0,a0,-556 # ffffffffc02030f0 <buddy_pmm_manager+0xd0>
ffffffffc0201324:	d8ffe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    pages = (struct Page *)ROUNDUP((void *)end, PGSIZE);
ffffffffc0201328:	777d                	lui	a4,0xfffff
ffffffffc020132a:	00007797          	auipc	a5,0x7
ffffffffc020132e:	28578793          	addi	a5,a5,645 # ffffffffc02085af <end+0xfff>
    for (size_t i = 0; i < npage - nbase; i++) {
ffffffffc0201332:	0009b603          	ld	a2,0(s3)
ffffffffc0201336:	8ff9                	and	a5,a5,a4
    pages = (struct Page *)ROUNDUP((void *)end, PGSIZE);
ffffffffc0201338:	00006a17          	auipc	s4,0x6
ffffffffc020133c:	248a0a13          	addi	s4,s4,584 # ffffffffc0207580 <pages>
ffffffffc0201340:	00fa3023          	sd	a5,0(s4)
    for (size_t i = 0; i < npage - nbase; i++) {
ffffffffc0201344:	00080737          	lui	a4,0x80
    pages = (struct Page *)ROUNDUP((void *)end, PGSIZE);
ffffffffc0201348:	00006597          	auipc	a1,0x6
ffffffffc020134c:	26858593          	addi	a1,a1,616 # ffffffffc02075b0 <end>
    for (size_t i = 0; i < npage - nbase; i++) {
ffffffffc0201350:	14e60263          	beq	a2,a4,ffffffffc0201494 <pmm_init+0x21e>
ffffffffc0201354:	4681                	li	a3,0
ffffffffc0201356:	4701                	li	a4,0
ffffffffc0201358:	4805                	li	a6,1
ffffffffc020135a:	fff80537          	lui	a0,0xfff80
ffffffffc020135e:	a019                	j	ffffffffc0201364 <pmm_init+0xee>
        SetPageReserved(pages + i);
ffffffffc0201360:	000a3783          	ld	a5,0(s4)
ffffffffc0201364:	97b6                	add	a5,a5,a3
ffffffffc0201366:	07a1                	addi	a5,a5,8
ffffffffc0201368:	4107b02f          	amoor.d	zero,a6,(a5)
    for (size_t i = 0; i < npage - nbase; i++) {
ffffffffc020136c:	0009b783          	ld	a5,0(s3)
ffffffffc0201370:	0705                	addi	a4,a4,1
ffffffffc0201372:	04868693          	addi	a3,a3,72
ffffffffc0201376:	00a78633          	add	a2,a5,a0
ffffffffc020137a:	fec763e3          	bltu	a4,a2,ffffffffc0201360 <pmm_init+0xea>
    uintptr_t freemem = PADDR((uintptr_t)pages + sizeof(struct Page) * (npage - nbase));
ffffffffc020137e:	00379413          	slli	s0,a5,0x3
ffffffffc0201382:	000a3683          	ld	a3,0(s4)
ffffffffc0201386:	943e                	add	s0,s0,a5
ffffffffc0201388:	040e                	slli	s0,s0,0x3
ffffffffc020138a:	9436                	add	s0,s0,a3
ffffffffc020138c:	fdc006b7          	lui	a3,0xfdc00
ffffffffc0201390:	9436                	add	s0,s0,a3
ffffffffc0201392:	c0200b37          	lui	s6,0xc0200
ffffffffc0201396:	17646863          	bltu	s0,s6,ffffffffc0201506 <pmm_init+0x290>
ffffffffc020139a:	609c                	ld	a5,0(s1)
    mem_begin = ROUNDUP(freemem, PGSIZE);
ffffffffc020139c:	6a85                	lui	s5,0x1
ffffffffc020139e:	1afd                	addi	s5,s5,-1
    uintptr_t freemem = PADDR((uintptr_t)pages + sizeof(struct Page) * (npage - nbase));
ffffffffc02013a0:	8c1d                	sub	s0,s0,a5
    mem_begin = ROUNDUP(freemem, PGSIZE);
ffffffffc02013a2:	9aa2                	add	s5,s5,s0
ffffffffc02013a4:	777d                	lui	a4,0xfffff
ffffffffc02013a6:	00eafab3          	and	s5,s5,a4
    cprintf("kern_end:  0x%016lx\n", (uint64_t)PADDR(end));
ffffffffc02013aa:	1365ee63          	bltu	a1,s6,ffffffffc02014e6 <pmm_init+0x270>
ffffffffc02013ae:	8d9d                	sub	a1,a1,a5
ffffffffc02013b0:	00002517          	auipc	a0,0x2
ffffffffc02013b4:	d8850513          	addi	a0,a0,-632 # ffffffffc0203138 <buddy_pmm_manager+0x118>
ffffffffc02013b8:	cfbfe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("pages:     0x%016lx\n", (uint64_t)PADDR(pages));
ffffffffc02013bc:	000a3683          	ld	a3,0(s4)
ffffffffc02013c0:	0f66ea63          	bltu	a3,s6,ffffffffc02014b4 <pmm_init+0x23e>
ffffffffc02013c4:	608c                	ld	a1,0(s1)
ffffffffc02013c6:	00002517          	auipc	a0,0x2
ffffffffc02013ca:	d8a50513          	addi	a0,a0,-630 # ffffffffc0203150 <buddy_pmm_manager+0x130>
    cprintf("mem_end:   0x%016lx\n", mem_end);
ffffffffc02013ce:	4b45                	li	s6,17
    cprintf("pages:     0x%016lx\n", (uint64_t)PADDR(pages));
ffffffffc02013d0:	40b685b3          	sub	a1,a3,a1
ffffffffc02013d4:	cdffe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("freemem:   0x%016lx\n", freemem);
ffffffffc02013d8:	85a2                	mv	a1,s0
ffffffffc02013da:	00002517          	auipc	a0,0x2
ffffffffc02013de:	d8e50513          	addi	a0,a0,-626 # ffffffffc0203168 <buddy_pmm_manager+0x148>
ffffffffc02013e2:	cd1fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("mem_begin: 0x%016lx\n", mem_begin);
ffffffffc02013e6:	85d6                	mv	a1,s5
ffffffffc02013e8:	00002517          	auipc	a0,0x2
ffffffffc02013ec:	d9850513          	addi	a0,a0,-616 # ffffffffc0203180 <buddy_pmm_manager+0x160>
ffffffffc02013f0:	cc3fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    cprintf("mem_end:   0x%016lx\n", mem_end);
ffffffffc02013f4:	01bb1593          	slli	a1,s6,0x1b
ffffffffc02013f8:	00002517          	auipc	a0,0x2
ffffffffc02013fc:	da050513          	addi	a0,a0,-608 # ffffffffc0203198 <buddy_pmm_manager+0x178>
    if (freemem < mem_end) {
ffffffffc0201400:	0b6e                	slli	s6,s6,0x1b
    cprintf("mem_end:   0x%016lx\n", mem_end);
ffffffffc0201402:	cb1fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    if (freemem < mem_end) {
ffffffffc0201406:	05646e63          	bltu	s0,s6,ffffffffc0201462 <pmm_init+0x1ec>
    satp_physical = PADDR(satp_virtual);
    cprintf("satp virtual address: 0x%016lx\nsatp physical address: 0x%016lx\n", satp_virtual, satp_physical);
}

static void check_alloc_page(void) {
    pmm_manager->check();
ffffffffc020140a:	00093783          	ld	a5,0(s2)
ffffffffc020140e:	63bc                	ld	a5,64(a5)
ffffffffc0201410:	9782                	jalr	a5
    cprintf("check_alloc_page() succeeded!\n");
ffffffffc0201412:	00002517          	auipc	a0,0x2
ffffffffc0201416:	dce50513          	addi	a0,a0,-562 # ffffffffc02031e0 <buddy_pmm_manager+0x1c0>
ffffffffc020141a:	c99fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    satp_virtual = (pte_t*)boot_page_table_sv39;
ffffffffc020141e:	00005597          	auipc	a1,0x5
ffffffffc0201422:	be258593          	addi	a1,a1,-1054 # ffffffffc0206000 <boot_page_table_sv39>
ffffffffc0201426:	00006797          	auipc	a5,0x6
ffffffffc020142a:	16b7b923          	sd	a1,370(a5) # ffffffffc0207598 <satp_virtual>
    satp_physical = PADDR(satp_virtual);
ffffffffc020142e:	c02007b7          	lui	a5,0xc0200
ffffffffc0201432:	08f5ed63          	bltu	a1,a5,ffffffffc02014cc <pmm_init+0x256>
ffffffffc0201436:	6090                	ld	a2,0(s1)
}
ffffffffc0201438:	7442                	ld	s0,48(sp)
ffffffffc020143a:	70e2                	ld	ra,56(sp)
ffffffffc020143c:	74a2                	ld	s1,40(sp)
ffffffffc020143e:	7902                	ld	s2,32(sp)
ffffffffc0201440:	69e2                	ld	s3,24(sp)
ffffffffc0201442:	6a42                	ld	s4,16(sp)
ffffffffc0201444:	6aa2                	ld	s5,8(sp)
ffffffffc0201446:	6b02                	ld	s6,0(sp)
    satp_physical = PADDR(satp_virtual);
ffffffffc0201448:	40c58633          	sub	a2,a1,a2
ffffffffc020144c:	00006797          	auipc	a5,0x6
ffffffffc0201450:	14c7b223          	sd	a2,324(a5) # ffffffffc0207590 <satp_physical>
    cprintf("satp virtual address: 0x%016lx\nsatp physical address: 0x%016lx\n", satp_virtual, satp_physical);
ffffffffc0201454:	00002517          	auipc	a0,0x2
ffffffffc0201458:	dac50513          	addi	a0,a0,-596 # ffffffffc0203200 <buddy_pmm_manager+0x1e0>
}
ffffffffc020145c:	6121                	addi	sp,sp,64
    cprintf("satp virtual address: 0x%016lx\nsatp physical address: 0x%016lx\n", satp_virtual, satp_physical);
ffffffffc020145e:	c55fe06f          	j	ffffffffc02000b2 <cprintf>
static inline int page_ref_dec(struct Page *page) {
    page->ref -= 1;
    return page->ref;
}
static inline struct Page *pa2page(uintptr_t pa) {
    if (PPN(pa) >= npage) {
ffffffffc0201462:	0009b703          	ld	a4,0(s3)
ffffffffc0201466:	00cad793          	srli	a5,s5,0xc
ffffffffc020146a:	02e7f963          	bgeu	a5,a4,ffffffffc020149c <pmm_init+0x226>
    pmm_manager->init_memmap(base, n);
ffffffffc020146e:	00093683          	ld	a3,0(s2)
        panic("pa2page called with invalid pa");
    }
    return &pages[PPN(pa) - nbase];
ffffffffc0201472:	fff80737          	lui	a4,0xfff80
ffffffffc0201476:	973e                	add	a4,a4,a5
ffffffffc0201478:	000a3503          	ld	a0,0(s4)
ffffffffc020147c:	00371793          	slli	a5,a4,0x3
ffffffffc0201480:	97ba                	add	a5,a5,a4
ffffffffc0201482:	6a98                	ld	a4,16(a3)
        init_memmap(pa2page(mem_begin), (mem_end - mem_begin) / PGSIZE);
ffffffffc0201484:	415b0b33          	sub	s6,s6,s5
ffffffffc0201488:	078e                	slli	a5,a5,0x3
    pmm_manager->init_memmap(base, n);
ffffffffc020148a:	00cb5593          	srli	a1,s6,0xc
ffffffffc020148e:	953e                	add	a0,a0,a5
ffffffffc0201490:	9702                	jalr	a4
}
ffffffffc0201492:	bfa5                	j	ffffffffc020140a <pmm_init+0x194>
ffffffffc0201494:	86be                	mv	a3,a5
    for (size_t i = 0; i < npage - nbase; i++) {
ffffffffc0201496:	02400437          	lui	s0,0x2400
ffffffffc020149a:	bdc5                	j	ffffffffc020138a <pmm_init+0x114>
        panic("pa2page called with invalid pa");
ffffffffc020149c:	00002617          	auipc	a2,0x2
ffffffffc02014a0:	d1460613          	addi	a2,a2,-748 # ffffffffc02031b0 <buddy_pmm_manager+0x190>
ffffffffc02014a4:	07300593          	li	a1,115
ffffffffc02014a8:	00002517          	auipc	a0,0x2
ffffffffc02014ac:	d2850513          	addi	a0,a0,-728 # ffffffffc02031d0 <buddy_pmm_manager+0x1b0>
ffffffffc02014b0:	efdfe0ef          	jal	ra,ffffffffc02003ac <__panic>
    cprintf("pages:     0x%016lx\n", (uint64_t)PADDR(pages));
ffffffffc02014b4:	00002617          	auipc	a2,0x2
ffffffffc02014b8:	c4c60613          	addi	a2,a2,-948 # ffffffffc0203100 <buddy_pmm_manager+0xe0>
ffffffffc02014bc:	0af00593          	li	a1,175
ffffffffc02014c0:	00002517          	auipc	a0,0x2
ffffffffc02014c4:	c6850513          	addi	a0,a0,-920 # ffffffffc0203128 <buddy_pmm_manager+0x108>
ffffffffc02014c8:	ee5fe0ef          	jal	ra,ffffffffc02003ac <__panic>
    satp_physical = PADDR(satp_virtual);
ffffffffc02014cc:	86ae                	mv	a3,a1
ffffffffc02014ce:	00002617          	auipc	a2,0x2
ffffffffc02014d2:	c3260613          	addi	a2,a2,-974 # ffffffffc0203100 <buddy_pmm_manager+0xe0>
ffffffffc02014d6:	0cb00593          	li	a1,203
ffffffffc02014da:	00002517          	auipc	a0,0x2
ffffffffc02014de:	c4e50513          	addi	a0,a0,-946 # ffffffffc0203128 <buddy_pmm_manager+0x108>
ffffffffc02014e2:	ecbfe0ef          	jal	ra,ffffffffc02003ac <__panic>
    cprintf("kern_end:  0x%016lx\n", (uint64_t)PADDR(end));
ffffffffc02014e6:	00006697          	auipc	a3,0x6
ffffffffc02014ea:	0ca68693          	addi	a3,a3,202 # ffffffffc02075b0 <end>
ffffffffc02014ee:	00002617          	auipc	a2,0x2
ffffffffc02014f2:	c1260613          	addi	a2,a2,-1006 # ffffffffc0203100 <buddy_pmm_manager+0xe0>
ffffffffc02014f6:	0ae00593          	li	a1,174
ffffffffc02014fa:	00002517          	auipc	a0,0x2
ffffffffc02014fe:	c2e50513          	addi	a0,a0,-978 # ffffffffc0203128 <buddy_pmm_manager+0x108>
ffffffffc0201502:	eabfe0ef          	jal	ra,ffffffffc02003ac <__panic>
    uintptr_t freemem = PADDR((uintptr_t)pages + sizeof(struct Page) * (npage - nbase));
ffffffffc0201506:	86a2                	mv	a3,s0
ffffffffc0201508:	00002617          	auipc	a2,0x2
ffffffffc020150c:	bf860613          	addi	a2,a2,-1032 # ffffffffc0203100 <buddy_pmm_manager+0xe0>
ffffffffc0201510:	0a900593          	li	a1,169
ffffffffc0201514:	00002517          	auipc	a0,0x2
ffffffffc0201518:	c1450513          	addi	a0,a0,-1004 # ffffffffc0203128 <buddy_pmm_manager+0x108>
ffffffffc020151c:	e91fe0ef          	jal	ra,ffffffffc02003ac <__panic>

ffffffffc0201520 <slob_alloc_bytes_from_page>:

    uint32_t slob_units = (n + SLOB_UNIT) / SLOB_UNIT - 1 + 2; // number of slob units needed

    // find the first slob_t that can hold the size
    slob_t *prev = NULL;
    slob_t *cur = (slob_t *)page->virtual;
ffffffffc0201520:	7510                	ld	a2,40(a0)
    uint32_t slob_units = (n + SLOB_UNIT) / SLOB_UNIT - 1 + 2; // number of slob units needed
ffffffffc0201522:	00258893          	addi	a7,a1,2
static void *slob_alloc_bytes_from_page(struct Page *page, size_t n) {
ffffffffc0201526:	1141                	addi	sp,sp,-16
    for (; ; prev = cur, cur = (slob_t *)((uintptr_t)cur + cur->slob_next_offset)) {
        // TODO: alignment
        // slob_t *aligned = (slob_t *)ALIGNUP((uintptr_t)cur, ALIGN_SIZE);
        // uint32_t delta = (uintptr_t)aligned - (uintptr_t)cur;
        if (cur->slob_units_left >= slob_units) {
ffffffffc0201528:	00065703          	lhu	a4,0(a2)
    uint32_t slob_units = (n + SLOB_UNIT) / SLOB_UNIT - 1 + 2; // number of slob units needed
ffffffffc020152c:	0018d893          	srli	a7,a7,0x1
ffffffffc0201530:	0018881b          	addiw	a6,a7,1
static void *slob_alloc_bytes_from_page(struct Page *page, size_t n) {
ffffffffc0201534:	e406                	sd	ra,8(sp)
ffffffffc0201536:	e022                	sd	s0,0(sp)
            if (cur->slob_units_left == slob_units) {
                // cprintf("[slob_debug] No need to split slob_t...\n");
                if (prev) {
                    prev->slob_next_offset += cur->slob_next_offset;
                } else {
                    page->virtual = (slob_t *)((uintptr_t)cur + cur->slob_next_offset);
ffffffffc0201538:	00265583          	lhu	a1,2(a2)
    uint32_t slob_units = (n + SLOB_UNIT) / SLOB_UNIT - 1 + 2; // number of slob units needed
ffffffffc020153c:	88c2                	mv	a7,a6
        if (cur->slob_units_left >= slob_units) {
ffffffffc020153e:	0d077363          	bgeu	a4,a6,ffffffffc0201604 <slob_alloc_bytes_from_page+0xe4>
static inline ppn_t page2ppn(struct Page *page) { return page - pages + nbase; }
ffffffffc0201542:	00006697          	auipc	a3,0x6
ffffffffc0201546:	03e6b683          	ld	a3,62(a3) # ffffffffc0207580 <pages>
ffffffffc020154a:	40d506b3          	sub	a3,a0,a3
ffffffffc020154e:	00002797          	auipc	a5,0x2
ffffffffc0201552:	64a7b783          	ld	a5,1610(a5) # ffffffffc0203b98 <nbase+0x8>
ffffffffc0201556:	868d                	srai	a3,a3,0x3
ffffffffc0201558:	02f686b3          	mul	a3,a3,a5
ffffffffc020155c:	00002797          	auipc	a5,0x2
ffffffffc0201560:	6347b783          	ld	a5,1588(a5) # ffffffffc0203b90 <nbase>
ffffffffc0201564:	96be                	add	a3,a3,a5
    return page2ppn(page) << PGSHIFT;
ffffffffc0201566:	06b2                	slli	a3,a3,0xc
                cprintf("[slob_debug] Page is full, removing from free list...\n");
            }
            return (void *)cur;
        }
        // if we reach the end of the page, then return NULL
        if (cur->slob_next_offset + (uintptr_t)cur >= page2pa(page) + PGSIZE) {
ffffffffc0201568:	6785                	lui	a5,0x1
ffffffffc020156a:	96be                	add	a3,a3,a5
ffffffffc020156c:	a819                	j	ffffffffc0201582 <slob_alloc_bytes_from_page+0x62>
        if (cur->slob_units_left >= slob_units) {
ffffffffc020156e:	0007d703          	lhu	a4,0(a5) # 1000 <kern_entry-0xffffffffc01ff000>
    for (; ; prev = cur, cur = (slob_t *)((uintptr_t)cur + cur->slob_next_offset)) {
ffffffffc0201572:	843e                	mv	s0,a5
        if (cur->slob_units_left >= slob_units) {
ffffffffc0201574:	0007031b          	sext.w	t1,a4
ffffffffc0201578:	01077f63          	bgeu	a4,a6,ffffffffc0201596 <slob_alloc_bytes_from_page+0x76>
        if (cur->slob_next_offset + (uintptr_t)cur >= page2pa(page) + PGSIZE) {
ffffffffc020157c:	0027d583          	lhu	a1,2(a5)
ffffffffc0201580:	863e                	mv	a2,a5
ffffffffc0201582:	00b607b3          	add	a5,a2,a1
ffffffffc0201586:	fed7e4e3          	bltu	a5,a3,ffffffffc020156e <slob_alloc_bytes_from_page+0x4e>
            // cprintf("[slob_debug] reached end of page\n");
            return NULL;
ffffffffc020158a:	4401                	li	s0,0
        }
    }
    cprintf("[slob_debug]: reached end of slob_alloc_bytes_from_page\n");
    return NULL;
}
ffffffffc020158c:	60a2                	ld	ra,8(sp)
ffffffffc020158e:	8522                	mv	a0,s0
ffffffffc0201590:	6402                	ld	s0,0(sp)
ffffffffc0201592:	0141                	addi	sp,sp,16
ffffffffc0201594:	8082                	ret
            if (cur->slob_units_left == slob_units) {
ffffffffc0201596:	07030163          	beq	t1,a6,ffffffffc02015f8 <slob_alloc_bytes_from_page+0xd8>
                    prev->slob_next_offset += slob_units * SLOB_UNIT;
ffffffffc020159a:	1842                	slli	a6,a6,0x30
ffffffffc020159c:	03085813          	srli	a6,a6,0x30
ffffffffc02015a0:	0018169b          	slliw	a3,a6,0x1
ffffffffc02015a4:	16c2                	slli	a3,a3,0x30
ffffffffc02015a6:	92c1                	srli	a3,a3,0x30
ffffffffc02015a8:	9db5                	addw	a1,a1,a3
                    page->virtual = (slob_t *)((uintptr_t)cur + slob_units * SLOB_UNIT);
ffffffffc02015aa:	0018979b          	slliw	a5,a7,0x1
                    prev->slob_next_offset += slob_units * SLOB_UNIT;
ffffffffc02015ae:	00b61123          	sh	a1,2(a2)
                    page->virtual = (slob_t *)((uintptr_t)cur + slob_units * SLOB_UNIT);
ffffffffc02015b2:	1782                	slli	a5,a5,0x20
                next->slob_next_offset = cur->slob_next_offset - slob_units * SLOB_UNIT;
ffffffffc02015b4:	00245583          	lhu	a1,2(s0) # 2400002 <kern_entry-0xffffffffbddffffe>
                    page->virtual = (slob_t *)((uintptr_t)cur + slob_units * SLOB_UNIT);
ffffffffc02015b8:	9381                	srli	a5,a5,0x20
                slob_t *next = (slob_t *)((uintptr_t)cur + slob_units * SLOB_UNIT);
ffffffffc02015ba:	97a2                	add	a5,a5,s0
                next->slob_units_left = cur->slob_units_left - slob_units;
ffffffffc02015bc:	4107073b          	subw	a4,a4,a6
                next->slob_next_offset = cur->slob_next_offset - slob_units * SLOB_UNIT;
ffffffffc02015c0:	40d586bb          	subw	a3,a1,a3
                next->slob_units_left = cur->slob_units_left - slob_units;
ffffffffc02015c4:	00e79023          	sh	a4,0(a5)
                next->slob_next_offset = cur->slob_next_offset - slob_units * SLOB_UNIT;
ffffffffc02015c8:	00d79123          	sh	a3,2(a5)
            page->slob_units_left -= slob_units;
ffffffffc02015cc:	591c                	lw	a5,48(a0)
            cur->slob_units_left = 0;
ffffffffc02015ce:	00041023          	sh	zero,0(s0)
            page->slob_units_left -= slob_units;
ffffffffc02015d2:	411787bb          	subw	a5,a5,a7
ffffffffc02015d6:	d91c                	sw	a5,48(a0)
            if (page->slob_units_left == 0) {
ffffffffc02015d8:	fbd5                	bnez	a5,ffffffffc020158c <slob_alloc_bytes_from_page+0x6c>
    __list_del(listelm->prev, listelm->next);
ffffffffc02015da:	7d18                	ld	a4,56(a0)
ffffffffc02015dc:	613c                	ld	a5,64(a0)
                cprintf("[slob_debug] Page is full, removing from free list...\n");
ffffffffc02015de:	00002517          	auipc	a0,0x2
ffffffffc02015e2:	c6250513          	addi	a0,a0,-926 # ffffffffc0203240 <buddy_pmm_manager+0x220>
    prev->next = next;
ffffffffc02015e6:	e71c                	sd	a5,8(a4)
    next->prev = prev;
ffffffffc02015e8:	e398                	sd	a4,0(a5)
ffffffffc02015ea:	ac9fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
}
ffffffffc02015ee:	60a2                	ld	ra,8(sp)
ffffffffc02015f0:	8522                	mv	a0,s0
ffffffffc02015f2:	6402                	ld	s0,0(sp)
ffffffffc02015f4:	0141                	addi	sp,sp,16
ffffffffc02015f6:	8082                	ret
                    prev->slob_next_offset += cur->slob_next_offset;
ffffffffc02015f8:	00245783          	lhu	a5,2(s0)
ffffffffc02015fc:	9dbd                	addw	a1,a1,a5
ffffffffc02015fe:	00b61123          	sh	a1,2(a2)
ffffffffc0201602:	b7e9                	j	ffffffffc02015cc <slob_alloc_bytes_from_page+0xac>
ffffffffc0201604:	0007079b          	sext.w	a5,a4
            if (cur->slob_units_left == slob_units) {
ffffffffc0201608:	02f80163          	beq	a6,a5,ffffffffc020162a <slob_alloc_bytes_from_page+0x10a>
                    page->virtual = (slob_t *)((uintptr_t)cur + slob_units * SLOB_UNIT);
ffffffffc020160c:	0018179b          	slliw	a5,a6,0x1
                next->slob_units_left = cur->slob_units_left - slob_units;
ffffffffc0201610:	1842                	slli	a6,a6,0x30
                    page->virtual = (slob_t *)((uintptr_t)cur + slob_units * SLOB_UNIT);
ffffffffc0201612:	1782                	slli	a5,a5,0x20
                next->slob_units_left = cur->slob_units_left - slob_units;
ffffffffc0201614:	03085813          	srli	a6,a6,0x30
                    page->virtual = (slob_t *)((uintptr_t)cur + slob_units * SLOB_UNIT);
ffffffffc0201618:	9381                	srli	a5,a5,0x20
                next->slob_next_offset = cur->slob_next_offset - slob_units * SLOB_UNIT;
ffffffffc020161a:	0018169b          	slliw	a3,a6,0x1
                    page->virtual = (slob_t *)((uintptr_t)cur + slob_units * SLOB_UNIT);
ffffffffc020161e:	97b2                	add	a5,a5,a2
                next->slob_next_offset = cur->slob_next_offset - slob_units * SLOB_UNIT;
ffffffffc0201620:	16c2                	slli	a3,a3,0x30
                    page->virtual = (slob_t *)((uintptr_t)cur + slob_units * SLOB_UNIT);
ffffffffc0201622:	f51c                	sd	a5,40(a0)
                next->slob_next_offset = cur->slob_next_offset - slob_units * SLOB_UNIT;
ffffffffc0201624:	92c1                	srli	a3,a3,0x30
ffffffffc0201626:	8432                	mv	s0,a2
ffffffffc0201628:	bf51                	j	ffffffffc02015bc <slob_alloc_bytes_from_page+0x9c>
                    page->virtual = (slob_t *)((uintptr_t)cur + cur->slob_next_offset);
ffffffffc020162a:	95b2                	add	a1,a1,a2
ffffffffc020162c:	f50c                	sd	a1,40(a0)
ffffffffc020162e:	8432                	mv	s0,a2
ffffffffc0201630:	bf71                	j	ffffffffc02015cc <slob_alloc_bytes_from_page+0xac>

ffffffffc0201632 <slob_init>:
static void slob_init(void) {
ffffffffc0201632:	1141                	addi	sp,sp,-16
    cprintf("[debug] Initializing SLOB...\n");
ffffffffc0201634:	00002517          	auipc	a0,0x2
ffffffffc0201638:	c4450513          	addi	a0,a0,-956 # ffffffffc0203278 <buddy_pmm_manager+0x258>
static void slob_init(void) {
ffffffffc020163c:	e406                	sd	ra,8(sp)
    cprintf("[debug] Initializing SLOB...\n");
ffffffffc020163e:	a75fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    buddy_pmm_manager.init();
ffffffffc0201642:	00002797          	auipc	a5,0x2
ffffffffc0201646:	9e67b783          	ld	a5,-1562(a5) # ffffffffc0203028 <buddy_pmm_manager+0x8>
ffffffffc020164a:	9782                	jalr	a5
    cprintf("[debug] Buddy system initialized.\n");
ffffffffc020164c:	00002517          	auipc	a0,0x2
ffffffffc0201650:	c4c50513          	addi	a0,a0,-948 # ffffffffc0203298 <buddy_pmm_manager+0x278>
ffffffffc0201654:	a5ffe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    elm->prev = elm->next = elm;
ffffffffc0201658:	00006797          	auipc	a5,0x6
ffffffffc020165c:	ac078793          	addi	a5,a5,-1344 # ffffffffc0207118 <slob_manager>
}
ffffffffc0201660:	60a2                	ld	ra,8(sp)
ffffffffc0201662:	00006617          	auipc	a2,0x6
ffffffffc0201666:	abe60613          	addi	a2,a2,-1346 # ffffffffc0207120 <slob_manager+0x8>
ffffffffc020166a:	00006697          	auipc	a3,0x6
ffffffffc020166e:	ace68693          	addi	a3,a3,-1330 # ffffffffc0207138 <slob_manager+0x20>
ffffffffc0201672:	00006717          	auipc	a4,0x6
ffffffffc0201676:	ade70713          	addi	a4,a4,-1314 # ffffffffc0207150 <slob_manager+0x38>
ffffffffc020167a:	eb90                	sd	a2,16(a5)
ffffffffc020167c:	e790                	sd	a2,8(a5)
    slob_manager.free_slob_small.nr_free = 0;
ffffffffc020167e:	0007ac23          	sw	zero,24(a5)
ffffffffc0201682:	f794                	sd	a3,40(a5)
ffffffffc0201684:	f394                	sd	a3,32(a5)
    slob_manager.free_slob_medium.nr_free = 0;
ffffffffc0201686:	0207a823          	sw	zero,48(a5)
ffffffffc020168a:	e3b8                	sd	a4,64(a5)
ffffffffc020168c:	ff98                	sd	a4,56(a5)
    slob_manager.free_slob_large.nr_free = 0;
ffffffffc020168e:	0407a423          	sw	zero,72(a5)
    cprintf("[debug] SLOB manager initialized.\n");
ffffffffc0201692:	00002517          	auipc	a0,0x2
ffffffffc0201696:	c2e50513          	addi	a0,a0,-978 # ffffffffc02032c0 <buddy_pmm_manager+0x2a0>
}
ffffffffc020169a:	0141                	addi	sp,sp,16
    cprintf("[debug] SLOB manager initialized.\n");
ffffffffc020169c:	a17fe06f          	j	ffffffffc02000b2 <cprintf>

ffffffffc02016a0 <slob_alloc_bytes>:

static void *slob_alloc_bytes(size_t n) {
ffffffffc02016a0:	7139                	addi	sp,sp,-64
ffffffffc02016a2:	ec4e                	sd	s3,24(sp)
    cprintf("[slob_debug] Allocating 0x%lx bytes using SLOB...\n", n);
ffffffffc02016a4:	85aa                	mv	a1,a0
static void *slob_alloc_bytes(size_t n) {
ffffffffc02016a6:	89aa                	mv	s3,a0
    cprintf("[slob_debug] Allocating 0x%lx bytes using SLOB...\n", n);
ffffffffc02016a8:	00002517          	auipc	a0,0x2
ffffffffc02016ac:	c4050513          	addi	a0,a0,-960 # ffffffffc02032e8 <buddy_pmm_manager+0x2c8>
static void *slob_alloc_bytes(size_t n) {
ffffffffc02016b0:	fc06                	sd	ra,56(sp)
ffffffffc02016b2:	f822                	sd	s0,48(sp)
ffffffffc02016b4:	f426                	sd	s1,40(sp)
ffffffffc02016b6:	f04a                	sd	s2,32(sp)
ffffffffc02016b8:	e852                	sd	s4,16(sp)
ffffffffc02016ba:	e456                	sd	s5,8(sp)
ffffffffc02016bc:	e05a                	sd	s6,0(sp)
    cprintf("[slob_debug] Allocating 0x%lx bytes using SLOB...\n", n);
ffffffffc02016be:	9f5fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    assert(n > 0);
ffffffffc02016c2:	1e098a63          	beqz	s3,ffffffffc02018b6 <slob_alloc_bytes+0x216>

    // if size after align is larger than a page, then use buddy system
    // if (ALIGNUP(n, ALIGN_SIZE) + SLOB_UNIT > PGSIZE) {
    if (n + sizeof(slob_t) > PGSIZE) {
ffffffffc02016c6:	00498793          	addi	a5,s3,4
ffffffffc02016ca:	6705                	lui	a4,0x1
ffffffffc02016cc:	16f76f63          	bltu	a4,a5,ffffffffc020184a <slob_alloc_bytes+0x1aa>
        cprintf("[slob -> buddy] Bytes allocated on buddy at address %p.\n", (void *)p->virtual);
        return p->virtual;
    } else {
        // find the first free_area_t that can hold the size
        free_area_t *slob_free_area = NULL;
        if (n <= SLOB_SMALL) {
ffffffffc02016d0:	10000793          	li	a5,256
ffffffffc02016d4:	1737f063          	bgeu	a5,s3,ffffffffc0201834 <slob_alloc_bytes+0x194>
            cprintf("[slob_debug] Allocating small size.\n");
            slob_free_area = &slob_manager.free_slob_small;
        } else if (n <= SLOB_MEDIUM) {
ffffffffc02016d8:	40000793          	li	a5,1024
ffffffffc02016dc:	1937e963          	bltu	a5,s3,ffffffffc020186e <slob_alloc_bytes+0x1ce>
            cprintf("[slob_debug] Allocating medium size.\n");
ffffffffc02016e0:	00002517          	auipc	a0,0x2
ffffffffc02016e4:	cc050513          	addi	a0,a0,-832 # ffffffffc02033a0 <buddy_pmm_manager+0x380>
ffffffffc02016e8:	9cbfe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
            slob_free_area = &slob_manager.free_slob_medium;
ffffffffc02016ec:	00006917          	auipc	s2,0x6
ffffffffc02016f0:	a4c90913          	addi	s2,s2,-1460 # ffffffffc0207138 <slob_manager+0x20>
        } else {
            cprintf("[slob_debug] Allocating large size.\n");
            slob_free_area = &slob_manager.free_slob_large;
        }
        
        uint32_t slob_units = (n + SLOB_UNIT) / SLOB_UNIT - 1 + 2; // number of slob units needed
ffffffffc02016f4:	00298a93          	addi	s5,s3,2
    return listelm->next;
ffffffffc02016f8:	00893403          	ld	s0,8(s2)
ffffffffc02016fc:	001ada93          	srli	s5,s5,0x1
ffffffffc0201700:	001a8a1b          	addiw	s4,s5,1
ffffffffc0201704:	8ad2                	mv	s5,s4
        slob_t *allocated_slob = NULL;
        
        // find the first page that can hold the size
        list_entry_t *le = &slob_free_area->free_list;
        while ((le = list_next(le)) != &slob_free_area->free_list) {
ffffffffc0201706:	02890c63          	beq	s2,s0,ffffffffc020173e <slob_alloc_bytes+0x9e>
            allocated_slob = slob_alloc_bytes_from_page(page, n);
            page->slob_units_left -= slob_units;
            if (page->slob_units_left == 0) {
                list_del(&page->slob_link);
                slob_free_area->nr_free--;
                cprintf("[slob_debug] Page is full, removing from free list...\n");
ffffffffc020170a:	00002b17          	auipc	s6,0x2
ffffffffc020170e:	b36b0b13          	addi	s6,s6,-1226 # ffffffffc0203240 <buddy_pmm_manager+0x220>
            if (page->slob_units_left < slob_units) {
ffffffffc0201712:	ff842783          	lw	a5,-8(s0)
ffffffffc0201716:	0347e163          	bltu	a5,s4,ffffffffc0201738 <slob_alloc_bytes+0x98>
            allocated_slob = slob_alloc_bytes_from_page(page, n);
ffffffffc020171a:	85ce                	mv	a1,s3
ffffffffc020171c:	fc840513          	addi	a0,s0,-56
ffffffffc0201720:	e01ff0ef          	jal	ra,ffffffffc0201520 <slob_alloc_bytes_from_page>
            page->slob_units_left -= slob_units;
ffffffffc0201724:	ff842783          	lw	a5,-8(s0)
            allocated_slob = slob_alloc_bytes_from_page(page, n);
ffffffffc0201728:	84aa                	mv	s1,a0
            page->slob_units_left -= slob_units;
ffffffffc020172a:	4147873b          	subw	a4,a5,s4
ffffffffc020172e:	fee42c23          	sw	a4,-8(s0)
            if (page->slob_units_left == 0) {
ffffffffc0201732:	cf61                	beqz	a4,ffffffffc020180a <slob_alloc_bytes+0x16a>
            }

            if (allocated_slob) {
ffffffffc0201734:	0e049863          	bnez	s1,ffffffffc0201824 <slob_alloc_bytes+0x184>
ffffffffc0201738:	6400                	ld	s0,8(s0)
        while ((le = list_next(le)) != &slob_free_area->free_list) {
ffffffffc020173a:	fc891ce3          	bne	s2,s0,ffffffffc0201712 <slob_alloc_bytes+0x72>
                break; // success
            }  
        }

        if (allocated_slob == NULL) {
            cprintf("[slob_debug] No page can hold the size, allocating a new page...\n");
ffffffffc020173e:	00002517          	auipc	a0,0x2
ffffffffc0201742:	d9250513          	addi	a0,a0,-622 # ffffffffc02034d0 <buddy_pmm_manager+0x4b0>
ffffffffc0201746:	96dfe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    return buddy_pmm_manager.alloc_pages(n);
ffffffffc020174a:	4505                	li	a0,1
ffffffffc020174c:	00002797          	auipc	a5,0x2
ffffffffc0201750:	8ec7b783          	ld	a5,-1812(a5) # ffffffffc0203038 <buddy_pmm_manager+0x18>
ffffffffc0201754:	9782                	jalr	a5
ffffffffc0201756:	842a                	mv	s0,a0
            // if no page can hold the size, then allocate a new page from buddy system
            struct Page *p = buddy_alloc_pages(1);
            if (p == NULL) {
ffffffffc0201758:	14050663          	beqz	a0,ffffffffc02018a4 <slob_alloc_bytes+0x204>
                return NULL; // no memory left
            }

            cprintf("[slob_debug] New page allocated at address %p.\n", (void *)p->virtual);
ffffffffc020175c:	740c                	ld	a1,40(s0)
ffffffffc020175e:	00002517          	auipc	a0,0x2
ffffffffc0201762:	c9250513          	addi	a0,a0,-878 # ffffffffc02033f0 <buddy_pmm_manager+0x3d0>
ffffffffc0201766:	94dfe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
static inline ppn_t page2ppn(struct Page *page) { return page - pages + nbase; }
ffffffffc020176a:	00006797          	auipc	a5,0x6
ffffffffc020176e:	e167b783          	ld	a5,-490(a5) # ffffffffc0207580 <pages>
ffffffffc0201772:	40f407b3          	sub	a5,s0,a5
ffffffffc0201776:	00002717          	auipc	a4,0x2
ffffffffc020177a:	42273703          	ld	a4,1058(a4) # ffffffffc0203b98 <nbase+0x8>
ffffffffc020177e:	878d                	srai	a5,a5,0x3
ffffffffc0201780:	02e787b3          	mul	a5,a5,a4
ffffffffc0201784:	00002897          	auipc	a7,0x2
ffffffffc0201788:	40c8b883          	ld	a7,1036(a7) # ffffffffc0203b90 <nbase>
    __list_add(elm, listelm, listelm->next);
ffffffffc020178c:	00893803          	ld	a6,8(s2)

            // these're redundant
            p->slob_units_left = 2048;
ffffffffc0201790:	6605                	lui	a2,0x1
ffffffffc0201792:	80060513          	addi	a0,a2,-2048 # 800 <kern_entry-0xffffffffc01ff800>
            p->virtual = (void *)(page2pa(p) + va_pa_offset);

            list_add_after(&slob_free_area->free_list, &(p->slob_link));
            slob_free_area->nr_free++;
ffffffffc0201796:	01092683          	lw	a3,16(s2)
            p->slob_units_left = 2048;
ffffffffc020179a:	d808                	sw	a0,48(s0)
            list_add_after(&slob_free_area->free_list, &(p->slob_link));
ffffffffc020179c:	03840713          	addi	a4,s0,56
            slob_t *slob = (slob_t *)p->virtual;
            slob->slob_units_left = 2048;
            slob->slob_next_offset = 4096;

            // attempt to allocate
            allocated_slob = slob_alloc_bytes_from_page(p, n);
ffffffffc02017a0:	85ce                	mv	a1,s3
ffffffffc02017a2:	97c6                	add	a5,a5,a7
    return page2ppn(page) << PGSHIFT;
ffffffffc02017a4:	07b2                	slli	a5,a5,0xc
            p->virtual = (void *)(page2pa(p) + va_pa_offset);
ffffffffc02017a6:	00006897          	auipc	a7,0x6
ffffffffc02017aa:	dfa8b883          	ld	a7,-518(a7) # ffffffffc02075a0 <va_pa_offset>
ffffffffc02017ae:	97c6                	add	a5,a5,a7
ffffffffc02017b0:	f41c                	sd	a5,40(s0)
    prev->next = next->prev = elm;
ffffffffc02017b2:	00e83023          	sd	a4,0(a6)
ffffffffc02017b6:	00e93423          	sd	a4,8(s2)
    elm->next = next;
ffffffffc02017ba:	05043023          	sd	a6,64(s0)
    elm->prev = prev;
ffffffffc02017be:	03243c23          	sd	s2,56(s0)
            slob_free_area->nr_free++;
ffffffffc02017c2:	0016871b          	addiw	a4,a3,1
ffffffffc02017c6:	00e92823          	sw	a4,16(s2)
            slob->slob_units_left = 2048;
ffffffffc02017ca:	00a79023          	sh	a0,0(a5)
            slob->slob_next_offset = 4096;
ffffffffc02017ce:	00c79123          	sh	a2,2(a5)
            allocated_slob = slob_alloc_bytes_from_page(p, n);
ffffffffc02017d2:	8522                	mv	a0,s0
ffffffffc02017d4:	d4dff0ef          	jal	ra,ffffffffc0201520 <slob_alloc_bytes_from_page>
ffffffffc02017d8:	84aa                	mv	s1,a0
            if (allocated_slob == NULL) {
ffffffffc02017da:	c579                	beqz	a0,ffffffffc02018a8 <slob_alloc_bytes+0x208>
                cprintf("[slob_debug] Failed to allocate from new page.\n");
                return NULL; // no memory left
            }

            p->slob_units_left -= slob_units;
ffffffffc02017dc:	581c                	lw	a5,48(s0)
ffffffffc02017de:	415787bb          	subw	a5,a5,s5
ffffffffc02017e2:	d81c                	sw	a5,48(s0)
            if (p->slob_units_left == 0) {
ffffffffc02017e4:	c3c5                	beqz	a5,ffffffffc0201884 <slob_alloc_bytes+0x1e4>
                cprintf("[slob_debug] Page is full, removing from free list...\n");
                list_del(&p->slob_link);
                slob_free_area->nr_free--;
            }

            cprintf("[slob_debug] Bytes allocated at address %p on new page.\n", (void *)allocated_slob);
ffffffffc02017e6:	85a6                	mv	a1,s1
ffffffffc02017e8:	00002517          	auipc	a0,0x2
ffffffffc02017ec:	c6850513          	addi	a0,a0,-920 # ffffffffc0203450 <buddy_pmm_manager+0x430>
ffffffffc02017f0:	8c3fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
        // debug
        cprintf("[slob_debug]: allocated_slob = %p reached end of slob_alloc_bytes\n", allocated_slob);
        return NULL;
    }

}
ffffffffc02017f4:	70e2                	ld	ra,56(sp)
ffffffffc02017f6:	7442                	ld	s0,48(sp)
ffffffffc02017f8:	7902                	ld	s2,32(sp)
ffffffffc02017fa:	69e2                	ld	s3,24(sp)
ffffffffc02017fc:	6a42                	ld	s4,16(sp)
ffffffffc02017fe:	6aa2                	ld	s5,8(sp)
ffffffffc0201800:	6b02                	ld	s6,0(sp)
ffffffffc0201802:	8526                	mv	a0,s1
ffffffffc0201804:	74a2                	ld	s1,40(sp)
ffffffffc0201806:	6121                	addi	sp,sp,64
ffffffffc0201808:	8082                	ret
    __list_del(listelm->prev, listelm->next);
ffffffffc020180a:	6014                	ld	a3,0(s0)
ffffffffc020180c:	6418                	ld	a4,8(s0)
                slob_free_area->nr_free--;
ffffffffc020180e:	01092783          	lw	a5,16(s2)
                cprintf("[slob_debug] Page is full, removing from free list...\n");
ffffffffc0201812:	855a                	mv	a0,s6
    prev->next = next;
ffffffffc0201814:	e698                	sd	a4,8(a3)
    next->prev = prev;
ffffffffc0201816:	e314                	sd	a3,0(a4)
                slob_free_area->nr_free--;
ffffffffc0201818:	37fd                	addiw	a5,a5,-1
ffffffffc020181a:	00f92823          	sw	a5,16(s2)
                cprintf("[slob_debug] Page is full, removing from free list...\n");
ffffffffc020181e:	895fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
            if (allocated_slob) {
ffffffffc0201822:	d899                	beqz	s1,ffffffffc0201738 <slob_alloc_bytes+0x98>
            cprintf("[slob_debug] Bytes allocated at address %p on exist page.\n", (void *)allocated_slob);
ffffffffc0201824:	85a6                	mv	a1,s1
ffffffffc0201826:	00002517          	auipc	a0,0x2
ffffffffc020182a:	c6a50513          	addi	a0,a0,-918 # ffffffffc0203490 <buddy_pmm_manager+0x470>
ffffffffc020182e:	885fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
            return (void *)allocated_slob;
ffffffffc0201832:	b7c9                	j	ffffffffc02017f4 <slob_alloc_bytes+0x154>
            cprintf("[slob_debug] Allocating small size.\n");
ffffffffc0201834:	00002517          	auipc	a0,0x2
ffffffffc0201838:	b4450513          	addi	a0,a0,-1212 # ffffffffc0203378 <buddy_pmm_manager+0x358>
ffffffffc020183c:	877fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
            slob_free_area = &slob_manager.free_slob_small;
ffffffffc0201840:	00006917          	auipc	s2,0x6
ffffffffc0201844:	8e090913          	addi	s2,s2,-1824 # ffffffffc0207120 <slob_manager+0x8>
ffffffffc0201848:	b575                	j	ffffffffc02016f4 <slob_alloc_bytes+0x54>
        struct Page *p = buddy_alloc_pages(n / PGSIZE + 1);
ffffffffc020184a:	00c9d513          	srli	a0,s3,0xc
    return buddy_pmm_manager.alloc_pages(n);
ffffffffc020184e:	00001797          	auipc	a5,0x1
ffffffffc0201852:	7ea7b783          	ld	a5,2026(a5) # ffffffffc0203038 <buddy_pmm_manager+0x18>
ffffffffc0201856:	0505                	addi	a0,a0,1
ffffffffc0201858:	9782                	jalr	a5
        cprintf("[slob -> buddy] Bytes allocated on buddy at address %p.\n", (void *)p->virtual);
ffffffffc020185a:	750c                	ld	a1,40(a0)
    return buddy_pmm_manager.alloc_pages(n);
ffffffffc020185c:	842a                	mv	s0,a0
        cprintf("[slob -> buddy] Bytes allocated on buddy at address %p.\n", (void *)p->virtual);
ffffffffc020185e:	00002517          	auipc	a0,0x2
ffffffffc0201862:	ada50513          	addi	a0,a0,-1318 # ffffffffc0203338 <buddy_pmm_manager+0x318>
ffffffffc0201866:	84dfe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
        return p->virtual;
ffffffffc020186a:	7404                	ld	s1,40(s0)
ffffffffc020186c:	b761                	j	ffffffffc02017f4 <slob_alloc_bytes+0x154>
            cprintf("[slob_debug] Allocating large size.\n");
ffffffffc020186e:	00002517          	auipc	a0,0x2
ffffffffc0201872:	b5a50513          	addi	a0,a0,-1190 # ffffffffc02033c8 <buddy_pmm_manager+0x3a8>
ffffffffc0201876:	83dfe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
            slob_free_area = &slob_manager.free_slob_large;
ffffffffc020187a:	00006917          	auipc	s2,0x6
ffffffffc020187e:	8d690913          	addi	s2,s2,-1834 # ffffffffc0207150 <slob_manager+0x38>
ffffffffc0201882:	bd8d                	j	ffffffffc02016f4 <slob_alloc_bytes+0x54>
                cprintf("[slob_debug] Page is full, removing from free list...\n");
ffffffffc0201884:	00002517          	auipc	a0,0x2
ffffffffc0201888:	9bc50513          	addi	a0,a0,-1604 # ffffffffc0203240 <buddy_pmm_manager+0x220>
ffffffffc020188c:	827fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    __list_del(listelm->prev, listelm->next);
ffffffffc0201890:	7c14                	ld	a3,56(s0)
ffffffffc0201892:	6038                	ld	a4,64(s0)
                slob_free_area->nr_free--;
ffffffffc0201894:	01092783          	lw	a5,16(s2)
    prev->next = next;
ffffffffc0201898:	e698                	sd	a4,8(a3)
    next->prev = prev;
ffffffffc020189a:	e314                	sd	a3,0(a4)
ffffffffc020189c:	37fd                	addiw	a5,a5,-1
ffffffffc020189e:	00f92823          	sw	a5,16(s2)
ffffffffc02018a2:	b791                	j	ffffffffc02017e6 <slob_alloc_bytes+0x146>
                return NULL; // no memory left
ffffffffc02018a4:	4481                	li	s1,0
ffffffffc02018a6:	b7b9                	j	ffffffffc02017f4 <slob_alloc_bytes+0x154>
                cprintf("[slob_debug] Failed to allocate from new page.\n");
ffffffffc02018a8:	00002517          	auipc	a0,0x2
ffffffffc02018ac:	b7850513          	addi	a0,a0,-1160 # ffffffffc0203420 <buddy_pmm_manager+0x400>
ffffffffc02018b0:	803fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
                return NULL; // no memory left
ffffffffc02018b4:	b781                	j	ffffffffc02017f4 <slob_alloc_bytes+0x154>
    assert(n > 0);
ffffffffc02018b6:	00001697          	auipc	a3,0x1
ffffffffc02018ba:	37a68693          	addi	a3,a3,890 # ffffffffc0202c30 <commands+0x598>
ffffffffc02018be:	00001617          	auipc	a2,0x1
ffffffffc02018c2:	2ea60613          	addi	a2,a2,746 # ffffffffc0202ba8 <commands+0x510>
ffffffffc02018c6:	08a00593          	li	a1,138
ffffffffc02018ca:	00002517          	auipc	a0,0x2
ffffffffc02018ce:	a5650513          	addi	a0,a0,-1450 # ffffffffc0203320 <buddy_pmm_manager+0x300>
ffffffffc02018d2:	adbfe0ef          	jal	ra,ffffffffc02003ac <__panic>

ffffffffc02018d6 <slob_init_memmap>:
static void slob_init_memmap(struct Page *base, size_t n) {
ffffffffc02018d6:	1101                	addi	sp,sp,-32
ffffffffc02018d8:	ec06                	sd	ra,24(sp)
ffffffffc02018da:	e822                	sd	s0,16(sp)
ffffffffc02018dc:	e426                	sd	s1,8(sp)
    assert(n > 0);
ffffffffc02018de:	c5b5                	beqz	a1,ffffffffc020194a <slob_init_memmap+0x74>
    buddy_pmm_manager.init_memmap(base, n);
ffffffffc02018e0:	00001797          	auipc	a5,0x1
ffffffffc02018e4:	7507b783          	ld	a5,1872(a5) # ffffffffc0203030 <buddy_pmm_manager+0x10>
ffffffffc02018e8:	84ae                	mv	s1,a1
ffffffffc02018ea:	842a                	mv	s0,a0
ffffffffc02018ec:	9782                	jalr	a5
    for (; p != base + n; p++) {
ffffffffc02018ee:	00349713          	slli	a4,s1,0x3
ffffffffc02018f2:	9726                	add	a4,a4,s1
ffffffffc02018f4:	070e                	slli	a4,a4,0x3
ffffffffc02018f6:	9722                	add	a4,a4,s0
ffffffffc02018f8:	04e40463          	beq	s0,a4,ffffffffc0201940 <slob_init_memmap+0x6a>
        p->slob_units_left = 2048;
ffffffffc02018fc:	6685                	lui	a3,0x1
static inline ppn_t page2ppn(struct Page *page) { return page - pages + nbase; }
ffffffffc02018fe:	00006817          	auipc	a6,0x6
ffffffffc0201902:	c8283803          	ld	a6,-894(a6) # ffffffffc0207580 <pages>
ffffffffc0201906:	00002517          	auipc	a0,0x2
ffffffffc020190a:	28a53503          	ld	a0,650(a0) # ffffffffc0203b90 <nbase>
        p->virtual = (void *)(page2pa(p) + va_pa_offset);
ffffffffc020190e:	00006597          	auipc	a1,0x6
ffffffffc0201912:	c925b583          	ld	a1,-878(a1) # ffffffffc02075a0 <va_pa_offset>
ffffffffc0201916:	00002617          	auipc	a2,0x2
ffffffffc020191a:	28263603          	ld	a2,642(a2) # ffffffffc0203b98 <nbase+0x8>
        p->slob_units_left = 2048;
ffffffffc020191e:	80068693          	addi	a3,a3,-2048 # 800 <kern_entry-0xffffffffc01ff800>
ffffffffc0201922:	410407b3          	sub	a5,s0,a6
ffffffffc0201926:	878d                	srai	a5,a5,0x3
ffffffffc0201928:	02c787b3          	mul	a5,a5,a2
ffffffffc020192c:	d814                	sw	a3,48(s0)
    for (; p != base + n; p++) {
ffffffffc020192e:	04840413          	addi	s0,s0,72
ffffffffc0201932:	97aa                	add	a5,a5,a0
    return page2ppn(page) << PGSHIFT;
ffffffffc0201934:	07b2                	slli	a5,a5,0xc
        p->virtual = (void *)(page2pa(p) + va_pa_offset);
ffffffffc0201936:	97ae                	add	a5,a5,a1
ffffffffc0201938:	fef43023          	sd	a5,-32(s0)
    for (; p != base + n; p++) {
ffffffffc020193c:	fee413e3          	bne	s0,a4,ffffffffc0201922 <slob_init_memmap+0x4c>
}
ffffffffc0201940:	60e2                	ld	ra,24(sp)
ffffffffc0201942:	6442                	ld	s0,16(sp)
ffffffffc0201944:	64a2                	ld	s1,8(sp)
ffffffffc0201946:	6105                	addi	sp,sp,32
ffffffffc0201948:	8082                	ret
    assert(n > 0);
ffffffffc020194a:	00001697          	auipc	a3,0x1
ffffffffc020194e:	2e668693          	addi	a3,a3,742 # ffffffffc0202c30 <commands+0x598>
ffffffffc0201952:	00001617          	auipc	a2,0x1
ffffffffc0201956:	25660613          	addi	a2,a2,598 # ffffffffc0202ba8 <commands+0x510>
ffffffffc020195a:	03c00593          	li	a1,60
ffffffffc020195e:	00002517          	auipc	a0,0x2
ffffffffc0201962:	9c250513          	addi	a0,a0,-1598 # ffffffffc0203320 <buddy_pmm_manager+0x300>
ffffffffc0201966:	a47fe0ef          	jal	ra,ffffffffc02003ac <__panic>

ffffffffc020196a <slob_nr_free_pages>:
ffffffffc020196a:	00001797          	auipc	a5,0x1
ffffffffc020196e:	6de7b783          	ld	a5,1758(a5) # ffffffffc0203048 <buddy_pmm_manager+0x28>
ffffffffc0201972:	8782                	jr	a5

ffffffffc0201974 <slob_alloc_pages>:
ffffffffc0201974:	00001797          	auipc	a5,0x1
ffffffffc0201978:	6c47b783          	ld	a5,1732(a5) # ffffffffc0203038 <buddy_pmm_manager+0x18>
ffffffffc020197c:	8782                	jr	a5

ffffffffc020197e <slob_free_pages>:
ffffffffc020197e:	00001797          	auipc	a5,0x1
ffffffffc0201982:	6c27b783          	ld	a5,1730(a5) # ffffffffc0203040 <buddy_pmm_manager+0x20>
ffffffffc0201986:	8782                	jr	a5

ffffffffc0201988 <slob_free_bytes>:

static void slob_free_bytes(void *ptr, size_t n) {
ffffffffc0201988:	1101                	addi	sp,sp,-32
ffffffffc020198a:	e426                	sd	s1,8(sp)
    cprintf("[slob_debug] Freeing 0x%lx bytes from address %p... using SLOB\n", n, ptr);
ffffffffc020198c:	862a                	mv	a2,a0
static void slob_free_bytes(void *ptr, size_t n) {
ffffffffc020198e:	84aa                	mv	s1,a0
    cprintf("[slob_debug] Freeing 0x%lx bytes from address %p... using SLOB\n", n, ptr);
ffffffffc0201990:	00002517          	auipc	a0,0x2
ffffffffc0201994:	b8850513          	addi	a0,a0,-1144 # ffffffffc0203518 <buddy_pmm_manager+0x4f8>
static void slob_free_bytes(void *ptr, size_t n) {
ffffffffc0201998:	e822                	sd	s0,16(sp)
ffffffffc020199a:	ec06                	sd	ra,24(sp)
ffffffffc020199c:	e04a                	sd	s2,0(sp)
ffffffffc020199e:	842e                	mv	s0,a1
    cprintf("[slob_debug] Freeing 0x%lx bytes from address %p... using SLOB\n", n, ptr);
ffffffffc02019a0:	f12fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    assert(ptr);
ffffffffc02019a4:	24048a63          	beqz	s1,ffffffffc0201bf8 <slob_free_bytes+0x270>
    assert(n > 0);
ffffffffc02019a8:	22040863          	beqz	s0,ffffffffc0201bd8 <slob_free_bytes+0x250>

    // If the size after alignment is larger than a page, then use buddy system
    if (n + sizeof(slob_t) > PGSIZE) {
ffffffffc02019ac:	00440793          	addi	a5,s0,4
ffffffffc02019b0:	6905                	lui	s2,0x1
ffffffffc02019b2:	16f96463          	bltu	s2,a5,ffffffffc0201b1a <slob_free_bytes+0x192>
        return;
    }

    // find the first free_area_t that can hold the size
    free_area_t *slob_free_area = NULL;
    if (n <= SLOB_SMALL) {
ffffffffc02019b6:	10000793          	li	a5,256
ffffffffc02019ba:	0a87ff63          	bgeu	a5,s0,ffffffffc0201a78 <slob_free_bytes+0xf0>
        cprintf("[slob_debug] Freeing small size.\n");
        slob_free_area = &slob_manager.free_slob_small;
    } else if (n <= SLOB_MEDIUM) {
ffffffffc02019be:	40000793          	li	a5,1024
ffffffffc02019c2:	0a87f063          	bgeu	a5,s0,ffffffffc0201a62 <slob_free_bytes+0xda>
        cprintf("[slob_debug] Freeing medium size.\n");
        slob_free_area = &slob_manager.free_slob_medium;
    } else {
        cprintf("[slob_debug] Freeing large size.\n");
ffffffffc02019c6:	00002517          	auipc	a0,0x2
ffffffffc02019ca:	c1a50513          	addi	a0,a0,-998 # ffffffffc02035e0 <buddy_pmm_manager+0x5c0>
ffffffffc02019ce:	ee4fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
        slob_free_area = &slob_manager.free_slob_large;
ffffffffc02019d2:	00005697          	auipc	a3,0x5
ffffffffc02019d6:	77e68693          	addi	a3,a3,1918 # ffffffffc0207150 <slob_manager+0x38>
    }

    slob_t *slob = (slob_t *)ptr;
    struct Page *page = pa2page((uintptr_t)slob - va_pa_offset);
ffffffffc02019da:	00006517          	auipc	a0,0x6
ffffffffc02019de:	bc653503          	ld	a0,-1082(a0) # ffffffffc02075a0 <va_pa_offset>
ffffffffc02019e2:	40a48533          	sub	a0,s1,a0
    if (PPN(pa) >= npage) {
ffffffffc02019e6:	8131                	srli	a0,a0,0xc
ffffffffc02019e8:	00006797          	auipc	a5,0x6
ffffffffc02019ec:	b907b783          	ld	a5,-1136(a5) # ffffffffc0207578 <npage>
ffffffffc02019f0:	22f57463          	bgeu	a0,a5,ffffffffc0201c18 <slob_free_bytes+0x290>
    return &pages[PPN(pa) - nbase];
ffffffffc02019f4:	00002797          	auipc	a5,0x2
ffffffffc02019f8:	19c7b783          	ld	a5,412(a5) # ffffffffc0203b90 <nbase>
ffffffffc02019fc:	8d1d                	sub	a0,a0,a5
ffffffffc02019fe:	00351793          	slli	a5,a0,0x3
ffffffffc0201a02:	953e                	add	a0,a0,a5
ffffffffc0201a04:	050e                	slli	a0,a0,0x3
ffffffffc0201a06:	00006797          	auipc	a5,0x6
ffffffffc0201a0a:	b7a7b783          	ld	a5,-1158(a5) # ffffffffc0207580 <pages>
ffffffffc0201a0e:	953e                	add	a0,a0,a5
    uint32_t slob_units = (n + SLOB_UNIT) / SLOB_UNIT - 1 + 2; // Number of slob units needed

    // If this slob makes the page completely free, free the page instead
    if (page->slob_units_left + slob_units == 2048) {
ffffffffc0201a10:	591c                	lw	a5,48(a0)
    uint32_t slob_units = (n + SLOB_UNIT) / SLOB_UNIT - 1 + 2; // Number of slob units needed
ffffffffc0201a12:	0409                	addi	s0,s0,2
ffffffffc0201a14:	8005                	srli	s0,s0,0x1
ffffffffc0201a16:	0014061b          	addiw	a2,s0,1
    if (page->slob_units_left + slob_units == 2048) {
ffffffffc0201a1a:	00c7873b          	addw	a4,a5,a2
ffffffffc0201a1e:	8007059b          	addiw	a1,a4,-2048
    uint32_t slob_units = (n + SLOB_UNIT) / SLOB_UNIT - 1 + 2; // Number of slob units needed
ffffffffc0201a22:	8432                	mv	s0,a2
    if (page->slob_units_left + slob_units == 2048) {
ffffffffc0201a24:	16058b63          	beqz	a1,ffffffffc0201b9a <slob_free_bytes+0x212>
    slob_t *cur = (slob_t *)page->virtual;
    slob_t *prev = NULL, *next = NULL;


    // if the page is fulled before, then add it to the free list
    if (page->slob_units_left == 0) {
ffffffffc0201a28:	c3bd                	beqz	a5,ffffffffc0201a8e <slob_free_bytes+0x106>
    slob_t *cur = (slob_t *)page->virtual;
ffffffffc0201a2a:	7514                	ld	a3,40(a0)
        slob->slob_next_offset = 2048 - slob_units;
        return;
    }

    // cprintf("[slob_debug] The page partially free before, freeing the slob...\n");
    page->slob_units_left += slob_units;
ffffffffc0201a2c:	d918                	sw	a4,48(a0)

    if ((void *)slob < page->virtual) {
ffffffffc0201a2e:	08d4fc63          	bgeu	s1,a3,ffffffffc0201ac6 <slob_free_bytes+0x13e>
        // cprintf("%lx, %lx", (void *)slob + slob_units * SLOB_UNIT, page->virtual);
        if ((void *)slob + slob_units * SLOB_UNIT == page->virtual) {
ffffffffc0201a32:	0016141b          	slliw	s0,a2,0x1
ffffffffc0201a36:	1402                	slli	s0,s0,0x20
ffffffffc0201a38:	9001                	srli	s0,s0,0x20
ffffffffc0201a3a:	9426                	add	s0,s0,s1
ffffffffc0201a3c:	14868263          	beq	a3,s0,ffffffffc0201b80 <slob_free_bytes+0x1f8>
            slob->slob_next_offset = ((slob_t *)page->virtual)->slob_next_offset;
            page->virtual = (void *)slob;
        } else {
            // cprintf("[slob_debug] Inserting before the first slob...\n");
            slob->slob_units_left = slob_units;
            slob->slob_next_offset = (uintptr_t)page->virtual - (uintptr_t)slob;
ffffffffc0201a40:	8e85                	sub	a3,a3,s1
            slob->slob_units_left = slob_units;
ffffffffc0201a42:	00c49023          	sh	a2,0(s1)
            slob->slob_next_offset = (uintptr_t)page->virtual - (uintptr_t)slob;
ffffffffc0201a46:	00d49123          	sh	a3,2(s1)
            page->virtual = (void *)slob;
ffffffffc0201a4a:	f504                	sd	s1,40(a0)
            prev->slob_next_offset = (uintptr_t)slob - (uintptr_t)prev; // Update the previous slob's offset
        }
    }
    cprintf("[slob_debug] Slob freed.\n");
    return;
}
ffffffffc0201a4c:	6442                	ld	s0,16(sp)
ffffffffc0201a4e:	60e2                	ld	ra,24(sp)
ffffffffc0201a50:	64a2                	ld	s1,8(sp)
ffffffffc0201a52:	6902                	ld	s2,0(sp)
    cprintf("[slob_debug] Slob freed.\n");
ffffffffc0201a54:	00002517          	auipc	a0,0x2
ffffffffc0201a58:	bb450513          	addi	a0,a0,-1100 # ffffffffc0203608 <buddy_pmm_manager+0x5e8>
}
ffffffffc0201a5c:	6105                	addi	sp,sp,32
    cprintf("[slob_debug] Slob freed.\n");
ffffffffc0201a5e:	e54fe06f          	j	ffffffffc02000b2 <cprintf>
        cprintf("[slob_debug] Freeing medium size.\n");
ffffffffc0201a62:	00002517          	auipc	a0,0x2
ffffffffc0201a66:	b5650513          	addi	a0,a0,-1194 # ffffffffc02035b8 <buddy_pmm_manager+0x598>
ffffffffc0201a6a:	e48fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
        slob_free_area = &slob_manager.free_slob_medium;
ffffffffc0201a6e:	00005697          	auipc	a3,0x5
ffffffffc0201a72:	6ca68693          	addi	a3,a3,1738 # ffffffffc0207138 <slob_manager+0x20>
ffffffffc0201a76:	b795                	j	ffffffffc02019da <slob_free_bytes+0x52>
        cprintf("[slob_debug] Freeing small size.\n");
ffffffffc0201a78:	00002517          	auipc	a0,0x2
ffffffffc0201a7c:	b1850513          	addi	a0,a0,-1256 # ffffffffc0203590 <buddy_pmm_manager+0x570>
ffffffffc0201a80:	e32fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
        slob_free_area = &slob_manager.free_slob_small;
ffffffffc0201a84:	00005697          	auipc	a3,0x5
ffffffffc0201a88:	69c68693          	addi	a3,a3,1692 # ffffffffc0207120 <slob_manager+0x8>
ffffffffc0201a8c:	b7b9                	j	ffffffffc02019da <slob_free_bytes+0x52>
    __list_add(elm, listelm, listelm->next);
ffffffffc0201a8e:	6698                	ld	a4,8(a3)
        slob_free_area->nr_free++;
ffffffffc0201a90:	4a9c                	lw	a5,16(a3)
        list_add_after(&slob_free_area->free_list, &page->slob_link);
ffffffffc0201a92:	03850593          	addi	a1,a0,56
    prev->next = next->prev = elm;
ffffffffc0201a96:	e30c                	sd	a1,0(a4)
ffffffffc0201a98:	e68c                	sd	a1,8(a3)
    elm->next = next;
ffffffffc0201a9a:	e138                	sd	a4,64(a0)
    elm->prev = prev;
ffffffffc0201a9c:	fd14                	sd	a3,56(a0)
        slob_free_area->nr_free++;
ffffffffc0201a9e:	2785                	addiw	a5,a5,1
ffffffffc0201aa0:	ca9c                	sw	a5,16(a3)
        slob->slob_units_left = slob_units;
ffffffffc0201aa2:	1642                	slli	a2,a2,0x30
        slob->slob_next_offset = 2048 - slob_units;
ffffffffc0201aa4:	6785                	lui	a5,0x1
        slob->slob_units_left = slob_units;
ffffffffc0201aa6:	9241                	srli	a2,a2,0x30
        slob->slob_next_offset = 2048 - slob_units;
ffffffffc0201aa8:	8007879b          	addiw	a5,a5,-2048
        page->slob_units_left = slob_units;
ffffffffc0201aac:	d900                	sw	s0,48(a0)
        page->virtual = (void *)slob;
ffffffffc0201aae:	f504                	sd	s1,40(a0)
        slob->slob_next_offset = 2048 - slob_units;
ffffffffc0201ab0:	9f91                	subw	a5,a5,a2
        slob->slob_units_left = slob_units;
ffffffffc0201ab2:	00c49023          	sh	a2,0(s1)
        slob->slob_next_offset = 2048 - slob_units;
ffffffffc0201ab6:	00f49123          	sh	a5,2(s1)
}
ffffffffc0201aba:	60e2                	ld	ra,24(sp)
ffffffffc0201abc:	6442                	ld	s0,16(sp)
ffffffffc0201abe:	64a2                	ld	s1,8(sp)
ffffffffc0201ac0:	6902                	ld	s2,0(sp)
ffffffffc0201ac2:	6105                	addi	sp,sp,32
ffffffffc0201ac4:	8082                	ret
        next = (slob_t *)((uintptr_t)prev + prev->slob_next_offset);
ffffffffc0201ac6:	0026d783          	lhu	a5,2(a3)
ffffffffc0201aca:	97b6                	add	a5,a5,a3
        while (next < slob) {
ffffffffc0201acc:	0097fb63          	bgeu	a5,s1,ffffffffc0201ae2 <slob_free_bytes+0x15a>
            next = (slob_t *)((uintptr_t)next + next->slob_next_offset);
ffffffffc0201ad0:	0027d703          	lhu	a4,2(a5) # 1002 <kern_entry-0xffffffffc01feffe>
ffffffffc0201ad4:	86be                	mv	a3,a5
ffffffffc0201ad6:	97ba                	add	a5,a5,a4
            if (next->slob_next_offset == 0) return;
ffffffffc0201ad8:	0027d703          	lhu	a4,2(a5)
ffffffffc0201adc:	df79                	beqz	a4,ffffffffc0201aba <slob_free_bytes+0x132>
        while (next < slob) {
ffffffffc0201ade:	fe97e9e3          	bltu	a5,s1,ffffffffc0201ad0 <slob_free_bytes+0x148>
        if ((void *)prev + prev->slob_units_left * SLOB_UNIT == (void *)slob) {
ffffffffc0201ae2:	0006d583          	lhu	a1,0(a3)
        slob->slob_units_left = slob_units;
ffffffffc0201ae6:	1642                	slli	a2,a2,0x30
ffffffffc0201ae8:	9241                	srli	a2,a2,0x30
        if ((void *)prev + prev->slob_units_left * SLOB_UNIT == (void *)slob) {
ffffffffc0201aea:	00159713          	slli	a4,a1,0x1
ffffffffc0201aee:	9736                	add	a4,a4,a3
ffffffffc0201af0:	0ce48263          	beq	s1,a4,ffffffffc0201bb4 <slob_free_bytes+0x22c>
        } else if ((void *)slob + slob_units * SLOB_UNIT == (void *)next) {
ffffffffc0201af4:	0014171b          	slliw	a4,s0,0x1
ffffffffc0201af8:	1702                	slli	a4,a4,0x20
ffffffffc0201afa:	9301                	srli	a4,a4,0x20
            prev->slob_next_offset = (uintptr_t)slob - (uintptr_t)prev; // Update the previous slob's offset
ffffffffc0201afc:	40d485b3          	sub	a1,s1,a3
ffffffffc0201b00:	15c2                	slli	a1,a1,0x30
        } else if ((void *)slob + slob_units * SLOB_UNIT == (void *)next) {
ffffffffc0201b02:	9726                	add	a4,a4,s1
            prev->slob_next_offset = (uintptr_t)slob - (uintptr_t)prev; // Update the previous slob's offset
ffffffffc0201b04:	91c1                	srli	a1,a1,0x30
        } else if ((void *)slob + slob_units * SLOB_UNIT == (void *)next) {
ffffffffc0201b06:	0ae78b63          	beq	a5,a4,ffffffffc0201bbc <slob_free_bytes+0x234>
            slob->slob_next_offset = (uintptr_t)next - (uintptr_t)slob; // Insert after the previous slob
ffffffffc0201b0a:	8f85                	sub	a5,a5,s1
            slob->slob_units_left = slob_units;
ffffffffc0201b0c:	00c49023          	sh	a2,0(s1)
            slob->slob_next_offset = (uintptr_t)next - (uintptr_t)slob; // Insert after the previous slob
ffffffffc0201b10:	00f49123          	sh	a5,2(s1)
            prev->slob_next_offset = (uintptr_t)slob - (uintptr_t)prev; // Update the previous slob's offset
ffffffffc0201b14:	00b69123          	sh	a1,2(a3)
ffffffffc0201b18:	bf15                	j	ffffffffc0201a4c <slob_free_bytes+0xc4>
        cprintf("[slob -> buddy] Freeing bytes on buddy...\n");
ffffffffc0201b1a:	00002517          	auipc	a0,0x2
ffffffffc0201b1e:	a4650513          	addi	a0,a0,-1466 # ffffffffc0203560 <buddy_pmm_manager+0x540>
ffffffffc0201b22:	d90fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
        struct Page *p = pa2page((uintptr_t)ptr - va_pa_offset);
ffffffffc0201b26:	00006517          	auipc	a0,0x6
ffffffffc0201b2a:	a7a53503          	ld	a0,-1414(a0) # ffffffffc02075a0 <va_pa_offset>
ffffffffc0201b2e:	40a48533          	sub	a0,s1,a0
    if (PPN(pa) >= npage) {
ffffffffc0201b32:	8131                	srli	a0,a0,0xc
ffffffffc0201b34:	00006797          	auipc	a5,0x6
ffffffffc0201b38:	a447b783          	ld	a5,-1468(a5) # ffffffffc0207578 <npage>
ffffffffc0201b3c:	0cf57e63          	bgeu	a0,a5,ffffffffc0201c18 <slob_free_bytes+0x290>
    return &pages[PPN(pa) - nbase];
ffffffffc0201b40:	00002497          	auipc	s1,0x2
ffffffffc0201b44:	0504b483          	ld	s1,80(s1) # ffffffffc0203b90 <nbase>
ffffffffc0201b48:	8d05                	sub	a0,a0,s1
ffffffffc0201b4a:	00351793          	slli	a5,a0,0x3
        buddy_free_pages(p, (n / PGSIZE) + ((n % PGSIZE) ? 1 : 0));
ffffffffc0201b4e:	197d                	addi	s2,s2,-1
ffffffffc0201b50:	953e                	add	a0,a0,a5
ffffffffc0201b52:	01247933          	and	s2,s0,s2
ffffffffc0201b56:	01203933          	snez	s2,s2
ffffffffc0201b5a:	00c45593          	srli	a1,s0,0xc
ffffffffc0201b5e:	050e                	slli	a0,a0,0x3
    buddy_pmm_manager.free_pages(base, n);
ffffffffc0201b60:	00006797          	auipc	a5,0x6
ffffffffc0201b64:	a207b783          	ld	a5,-1504(a5) # ffffffffc0207580 <pages>
ffffffffc0201b68:	95ca                	add	a1,a1,s2
ffffffffc0201b6a:	953e                	add	a0,a0,a5
}
ffffffffc0201b6c:	6442                	ld	s0,16(sp)
ffffffffc0201b6e:	60e2                	ld	ra,24(sp)
ffffffffc0201b70:	64a2                	ld	s1,8(sp)
ffffffffc0201b72:	6902                	ld	s2,0(sp)
    buddy_pmm_manager.free_pages(base, n);
ffffffffc0201b74:	00001797          	auipc	a5,0x1
ffffffffc0201b78:	4cc7b783          	ld	a5,1228(a5) # ffffffffc0203040 <buddy_pmm_manager+0x20>
}
ffffffffc0201b7c:	6105                	addi	sp,sp,32
    buddy_pmm_manager.free_pages(base, n);
ffffffffc0201b7e:	8782                	jr	a5
            slob->slob_units_left += ((slob_t *)page->virtual)->slob_units_left;
ffffffffc0201b80:	0006d603          	lhu	a2,0(a3)
ffffffffc0201b84:	0004d783          	lhu	a5,0(s1)
            slob->slob_next_offset = ((slob_t *)page->virtual)->slob_next_offset;
ffffffffc0201b88:	0026d703          	lhu	a4,2(a3)
            slob->slob_units_left += ((slob_t *)page->virtual)->slob_units_left;
ffffffffc0201b8c:	9fb1                	addw	a5,a5,a2
ffffffffc0201b8e:	00f49023          	sh	a5,0(s1)
            slob->slob_next_offset = ((slob_t *)page->virtual)->slob_next_offset;
ffffffffc0201b92:	00e49123          	sh	a4,2(s1)
            page->virtual = (void *)slob;
ffffffffc0201b96:	f504                	sd	s1,40(a0)
ffffffffc0201b98:	bd55                	j	ffffffffc0201a4c <slob_free_bytes+0xc4>
    __list_del(listelm->prev, listelm->next);
ffffffffc0201b9a:	7d10                	ld	a2,56(a0)
ffffffffc0201b9c:	6134                	ld	a3,64(a0)
        slob_manager.free_slob_small.nr_free--;
ffffffffc0201b9e:	00005717          	auipc	a4,0x5
ffffffffc0201ba2:	57a70713          	addi	a4,a4,1402 # ffffffffc0207118 <slob_manager>
ffffffffc0201ba6:	4f1c                	lw	a5,24(a4)
    prev->next = next;
ffffffffc0201ba8:	e614                	sd	a3,8(a2)
    next->prev = prev;
ffffffffc0201baa:	e290                	sd	a2,0(a3)
ffffffffc0201bac:	37fd                	addiw	a5,a5,-1
ffffffffc0201bae:	cf1c                	sw	a5,24(a4)
    buddy_pmm_manager.free_pages(base, n);
ffffffffc0201bb0:	4585                	li	a1,1
ffffffffc0201bb2:	bf6d                	j	ffffffffc0201b6c <slob_free_bytes+0x1e4>
            prev->slob_units_left += slob_units;
ffffffffc0201bb4:	9e2d                	addw	a2,a2,a1
ffffffffc0201bb6:	00c69023          	sh	a2,0(a3)
ffffffffc0201bba:	bd49                	j	ffffffffc0201a4c <slob_free_bytes+0xc4>
            slob->slob_next_offset = next->slob_next_offset + (uintptr_t)next - (uintptr_t)slob; // Merge with the next slob
ffffffffc0201bbc:	0027d703          	lhu	a4,2(a5)
            slob->slob_units_left = next->slob_units_left + slob_units;
ffffffffc0201bc0:	0007d503          	lhu	a0,0(a5)
            slob->slob_next_offset = next->slob_next_offset + (uintptr_t)next - (uintptr_t)slob; // Merge with the next slob
ffffffffc0201bc4:	9f05                	subw	a4,a4,s1
            slob->slob_units_left = next->slob_units_left + slob_units;
ffffffffc0201bc6:	9e29                	addw	a2,a2,a0
            slob->slob_next_offset = next->slob_next_offset + (uintptr_t)next - (uintptr_t)slob; // Merge with the next slob
ffffffffc0201bc8:	9fb9                	addw	a5,a5,a4
            slob->slob_units_left = next->slob_units_left + slob_units;
ffffffffc0201bca:	00c49023          	sh	a2,0(s1)
            slob->slob_next_offset = next->slob_next_offset + (uintptr_t)next - (uintptr_t)slob; // Merge with the next slob
ffffffffc0201bce:	00f49123          	sh	a5,2(s1)
            prev->slob_next_offset = (uintptr_t)slob - (uintptr_t)prev; // Update the previous slob's offset
ffffffffc0201bd2:	00b69123          	sh	a1,2(a3)
ffffffffc0201bd6:	bd9d                	j	ffffffffc0201a4c <slob_free_bytes+0xc4>
    assert(n > 0);
ffffffffc0201bd8:	00001697          	auipc	a3,0x1
ffffffffc0201bdc:	05868693          	addi	a3,a3,88 # ffffffffc0202c30 <commands+0x598>
ffffffffc0201be0:	00001617          	auipc	a2,0x1
ffffffffc0201be4:	fc860613          	addi	a2,a2,-56 # ffffffffc0202ba8 <commands+0x510>
ffffffffc0201be8:	0f100593          	li	a1,241
ffffffffc0201bec:	00001517          	auipc	a0,0x1
ffffffffc0201bf0:	73450513          	addi	a0,a0,1844 # ffffffffc0203320 <buddy_pmm_manager+0x300>
ffffffffc0201bf4:	fb8fe0ef          	jal	ra,ffffffffc02003ac <__panic>
    assert(ptr);
ffffffffc0201bf8:	00002697          	auipc	a3,0x2
ffffffffc0201bfc:	96068693          	addi	a3,a3,-1696 # ffffffffc0203558 <buddy_pmm_manager+0x538>
ffffffffc0201c00:	00001617          	auipc	a2,0x1
ffffffffc0201c04:	fa860613          	addi	a2,a2,-88 # ffffffffc0202ba8 <commands+0x510>
ffffffffc0201c08:	0f000593          	li	a1,240
ffffffffc0201c0c:	00001517          	auipc	a0,0x1
ffffffffc0201c10:	71450513          	addi	a0,a0,1812 # ffffffffc0203320 <buddy_pmm_manager+0x300>
ffffffffc0201c14:	f98fe0ef          	jal	ra,ffffffffc02003ac <__panic>
        panic("pa2page called with invalid pa");
ffffffffc0201c18:	00001617          	auipc	a2,0x1
ffffffffc0201c1c:	59860613          	addi	a2,a2,1432 # ffffffffc02031b0 <buddy_pmm_manager+0x190>
ffffffffc0201c20:	07300593          	li	a1,115
ffffffffc0201c24:	00001517          	auipc	a0,0x1
ffffffffc0201c28:	5ac50513          	addi	a0,a0,1452 # ffffffffc02031d0 <buddy_pmm_manager+0x1b0>
ffffffffc0201c2c:	f80fe0ef          	jal	ra,ffffffffc02003ac <__panic>

ffffffffc0201c30 <slob_check>:

static void slob_check(void) {
ffffffffc0201c30:	7115                	addi	sp,sp,-224
    cprintf("[slob_check]: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
ffffffffc0201c32:	00002517          	auipc	a0,0x2
ffffffffc0201c36:	9f650513          	addi	a0,a0,-1546 # ffffffffc0203628 <buddy_pmm_manager+0x608>
static void slob_check(void) {
ffffffffc0201c3a:	ed86                	sd	ra,216(sp)
ffffffffc0201c3c:	e9a2                	sd	s0,208(sp)
ffffffffc0201c3e:	e5a6                	sd	s1,200(sp)
ffffffffc0201c40:	e1ca                	sd	s2,192(sp)
ffffffffc0201c42:	fd4e                	sd	s3,184(sp)
ffffffffc0201c44:	f952                	sd	s4,176(sp)
ffffffffc0201c46:	f15a                	sd	s6,160(sp)
ffffffffc0201c48:	f556                	sd	s5,168(sp)
ffffffffc0201c4a:	ed5e                	sd	s7,152(sp)
    cprintf("[slob_check]: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
ffffffffc0201c4c:	c66fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>

    size_t sizes[] = {16, 32, 64, 128, 256, 512, 1024, 2048, 4096};
ffffffffc0201c50:	00002797          	auipc	a5,0x2
ffffffffc0201c54:	c6878793          	addi	a5,a5,-920 # ffffffffc02038b8 <buddy_pmm_manager+0x898>
ffffffffc0201c58:	0007be03          	ld	t3,0(a5)
ffffffffc0201c5c:	0087b303          	ld	t1,8(a5)
ffffffffc0201c60:	0107b883          	ld	a7,16(a5)
ffffffffc0201c64:	0187b803          	ld	a6,24(a5)
ffffffffc0201c68:	738c                	ld	a1,32(a5)
ffffffffc0201c6a:	7790                	ld	a2,40(a5)
ffffffffc0201c6c:	7b94                	ld	a3,48(a5)
ffffffffc0201c6e:	7f98                	ld	a4,56(a5)
ffffffffc0201c70:	63bc                	ld	a5,64(a5)
ffffffffc0201c72:	00a0                	addi	s0,sp,72
    void *ptrs[sizeof(sizes)/sizeof(size_t)];

    cprintf(">>>[slob_check]: Test case 1: Basic allocation.<<<\n");
ffffffffc0201c74:	00002517          	auipc	a0,0x2
ffffffffc0201c78:	9e450513          	addi	a0,a0,-1564 # ffffffffc0203658 <buddy_pmm_manager+0x638>
ffffffffc0201c7c:	890a                	mv	s2,sp
    size_t sizes[] = {16, 32, 64, 128, 256, 512, 1024, 2048, 4096};
ffffffffc0201c7e:	e072                	sd	t3,0(sp)
ffffffffc0201c80:	e41a                	sd	t1,8(sp)
ffffffffc0201c82:	e846                	sd	a7,16(sp)
ffffffffc0201c84:	ec42                	sd	a6,24(sp)
ffffffffc0201c86:	f02e                	sd	a1,32(sp)
ffffffffc0201c88:	f432                	sd	a2,40(sp)
ffffffffc0201c8a:	f836                	sd	a3,48(sp)
ffffffffc0201c8c:	fc3a                	sd	a4,56(sp)
ffffffffc0201c8e:	e0be                	sd	a5,64(sp)
    cprintf(">>>[slob_check]: Test case 1: Basic allocation.<<<\n");
ffffffffc0201c90:	89a2                	mv	s3,s0
ffffffffc0201c92:	c20fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0201c96:	8a22                	mv	s4,s0
ffffffffc0201c98:	84ca                	mv	s1,s2
    // Test case 1: Basic allocation and deallocation
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
        ptrs[i] = slob_alloc_bytes(sizes[i]);
        assert(ptrs[i]);  // Assertion to check if allocation was successful
        cprintf("[slob_test] Successfully allocated %lx bytes at address %p.\n", sizes[i], ptrs[i]);
ffffffffc0201c9a:	00002b17          	auipc	s6,0x2
ffffffffc0201c9e:	9feb0b13          	addi	s6,s6,-1538 # ffffffffc0203698 <buddy_pmm_manager+0x678>
        ptrs[i] = slob_alloc_bytes(sizes[i]);
ffffffffc0201ca2:	0004ba83          	ld	s5,0(s1)
ffffffffc0201ca6:	8556                	mv	a0,s5
ffffffffc0201ca8:	9f9ff0ef          	jal	ra,ffffffffc02016a0 <slob_alloc_bytes>
ffffffffc0201cac:	00aa3023          	sd	a0,0(s4)
ffffffffc0201cb0:	862a                	mv	a2,a0
        assert(ptrs[i]);  // Assertion to check if allocation was successful
ffffffffc0201cb2:	1a050a63          	beqz	a0,ffffffffc0201e66 <slob_check+0x236>
        cprintf("[slob_test] Successfully allocated %lx bytes at address %p.\n", sizes[i], ptrs[i]);
ffffffffc0201cb6:	85d6                	mv	a1,s5
ffffffffc0201cb8:	855a                	mv	a0,s6
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
ffffffffc0201cba:	04a1                	addi	s1,s1,8
        cprintf("[slob_test] Successfully allocated %lx bytes at address %p.\n", sizes[i], ptrs[i]);
ffffffffc0201cbc:	bf6fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
ffffffffc0201cc0:	0a21                	addi	s4,s4,8
ffffffffc0201cc2:	fe8490e3          	bne	s1,s0,ffffffffc0201ca2 <slob_check+0x72>
    }

    cprintf(">>>[slob_check]: Test case 2: Basic deallocation.<<<\n");
ffffffffc0201cc6:	00002517          	auipc	a0,0x2
ffffffffc0201cca:	a1250513          	addi	a0,a0,-1518 # ffffffffc02036d8 <buddy_pmm_manager+0x6b8>
ffffffffc0201cce:	be4fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    // Test case 2: Basic deallocation
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
ffffffffc0201cd2:	04840b93          	addi	s7,s0,72
    cprintf(">>>[slob_check]: Test case 2: Basic deallocation.<<<\n");
ffffffffc0201cd6:	8a4a                	mv	s4,s2
ffffffffc0201cd8:	84a2                	mv	s1,s0
        slob_free_bytes(ptrs[i], sizes[i]);
        cprintf("[slob_test] Successfully deallocated memory at address %p.\n", ptrs[i]);
ffffffffc0201cda:	00002b17          	auipc	s6,0x2
ffffffffc0201cde:	a36b0b13          	addi	s6,s6,-1482 # ffffffffc0203710 <buddy_pmm_manager+0x6f0>
        slob_free_bytes(ptrs[i], sizes[i]);
ffffffffc0201ce2:	0004ba83          	ld	s5,0(s1)
ffffffffc0201ce6:	000a3583          	ld	a1,0(s4)
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
ffffffffc0201cea:	04a1                	addi	s1,s1,8
        slob_free_bytes(ptrs[i], sizes[i]);
ffffffffc0201cec:	8556                	mv	a0,s5
ffffffffc0201cee:	c9bff0ef          	jal	ra,ffffffffc0201988 <slob_free_bytes>
        cprintf("[slob_test] Successfully deallocated memory at address %p.\n", ptrs[i]);
ffffffffc0201cf2:	85d6                	mv	a1,s5
ffffffffc0201cf4:	855a                	mv	a0,s6
ffffffffc0201cf6:	bbcfe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
ffffffffc0201cfa:	0a21                	addi	s4,s4,8
ffffffffc0201cfc:	ff7493e3          	bne	s1,s7,ffffffffc0201ce2 <slob_check+0xb2>
    }

    cprintf(">>>[slob_check]: Test case 3: Allocate and partially deallocate memory blocks.<<<\n");
ffffffffc0201d00:	00002517          	auipc	a0,0x2
ffffffffc0201d04:	a5050513          	addi	a0,a0,-1456 # ffffffffc0203750 <buddy_pmm_manager+0x730>
ffffffffc0201d08:	baafe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0201d0c:	8a22                	mv	s4,s0
ffffffffc0201d0e:	84ca                	mv	s1,s2
    // Test case 3: Allocate and partially deallocate memory blocks
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
        ptrs[i] = slob_alloc_bytes(sizes[i]);
        assert(ptrs[i]);
        cprintf("[slob_test] Successfully allocated %lx bytes at address %p.\n", sizes[i], ptrs[i]);
ffffffffc0201d10:	00002b17          	auipc	s6,0x2
ffffffffc0201d14:	988b0b13          	addi	s6,s6,-1656 # ffffffffc0203698 <buddy_pmm_manager+0x678>
        ptrs[i] = slob_alloc_bytes(sizes[i]);
ffffffffc0201d18:	0004ba83          	ld	s5,0(s1)
ffffffffc0201d1c:	8556                	mv	a0,s5
ffffffffc0201d1e:	983ff0ef          	jal	ra,ffffffffc02016a0 <slob_alloc_bytes>
ffffffffc0201d22:	00aa3023          	sd	a0,0(s4)
ffffffffc0201d26:	862a                	mv	a2,a0
        assert(ptrs[i]);
ffffffffc0201d28:	16050f63          	beqz	a0,ffffffffc0201ea6 <slob_check+0x276>
        cprintf("[slob_test] Successfully allocated %lx bytes at address %p.\n", sizes[i], ptrs[i]);
ffffffffc0201d2c:	85d6                	mv	a1,s5
ffffffffc0201d2e:	855a                	mv	a0,s6
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
ffffffffc0201d30:	04a1                	addi	s1,s1,8
        cprintf("[slob_test] Successfully allocated %lx bytes at address %p.\n", sizes[i], ptrs[i]);
ffffffffc0201d32:	b80fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
ffffffffc0201d36:	0a21                	addi	s4,s4,8
ffffffffc0201d38:	fe8490e3          	bne	s1,s0,ffffffffc0201d18 <slob_check+0xe8>
ffffffffc0201d3c:	05040b93          	addi	s7,s0,80
ffffffffc0201d40:	8a4a                	mv	s4,s2
ffffffffc0201d42:	84a2                	mv	s1,s0
    }

    // Partial deallocation
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i += 2) {  // Freeing alternate blocks
        slob_free_bytes(ptrs[i], sizes[i]);
        cprintf("[slob_test] Successfully deallocated memory at address %p.\n", ptrs[i]);
ffffffffc0201d44:	00002b17          	auipc	s6,0x2
ffffffffc0201d48:	9ccb0b13          	addi	s6,s6,-1588 # ffffffffc0203710 <buddy_pmm_manager+0x6f0>
        slob_free_bytes(ptrs[i], sizes[i]);
ffffffffc0201d4c:	0004ba83          	ld	s5,0(s1)
ffffffffc0201d50:	000a3583          	ld	a1,0(s4)
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i += 2) {  // Freeing alternate blocks
ffffffffc0201d54:	04c1                	addi	s1,s1,16
        slob_free_bytes(ptrs[i], sizes[i]);
ffffffffc0201d56:	8556                	mv	a0,s5
ffffffffc0201d58:	c31ff0ef          	jal	ra,ffffffffc0201988 <slob_free_bytes>
        cprintf("[slob_test] Successfully deallocated memory at address %p.\n", ptrs[i]);
ffffffffc0201d5c:	85d6                	mv	a1,s5
ffffffffc0201d5e:	855a                	mv	a0,s6
ffffffffc0201d60:	b52fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
        ptrs[i] = NULL;  // Mark the pointer as NULL after deallocation
ffffffffc0201d64:	fe04b823          	sd	zero,-16(s1)
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i += 2) {  // Freeing alternate blocks
ffffffffc0201d68:	0a41                	addi	s4,s4,16
ffffffffc0201d6a:	ff7491e3          	bne	s1,s7,ffffffffc0201d4c <slob_check+0x11c>
    }

    cprintf(">>>[slob_check]: Test case 4: Fragmentation test.<<<\n");
ffffffffc0201d6e:	00002517          	auipc	a0,0x2
ffffffffc0201d72:	a3a50513          	addi	a0,a0,-1478 # ffffffffc02037a8 <buddy_pmm_manager+0x788>
ffffffffc0201d76:	b3cfe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    // Test case 4: Fragmentation test
    // Allocate smaller blocks to check if they occupy the freed spaces efficiently
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i += 2) {
ffffffffc0201d7a:	05090b93          	addi	s7,s2,80 # 1050 <kern_entry-0xffffffffc01fefb0>
    cprintf(">>>[slob_check]: Test case 4: Fragmentation test.<<<\n");
ffffffffc0201d7e:	8aa2                	mv	s5,s0
ffffffffc0201d80:	8a4a                	mv	s4,s2
        // slob_debug();
        ptrs[i] = slob_alloc_bytes(sizes[i]/2);  // Allocating smaller sizes
        assert(ptrs[i]);
        cprintf("[slob_test] Successfully allocated %lx bytes at address %p.\n", sizes[i]/2, ptrs[i]);
ffffffffc0201d82:	00002b17          	auipc	s6,0x2
ffffffffc0201d86:	916b0b13          	addi	s6,s6,-1770 # ffffffffc0203698 <buddy_pmm_manager+0x678>
        ptrs[i] = slob_alloc_bytes(sizes[i]/2);  // Allocating smaller sizes
ffffffffc0201d8a:	000a3483          	ld	s1,0(s4)
ffffffffc0201d8e:	8085                	srli	s1,s1,0x1
ffffffffc0201d90:	8526                	mv	a0,s1
ffffffffc0201d92:	90fff0ef          	jal	ra,ffffffffc02016a0 <slob_alloc_bytes>
ffffffffc0201d96:	00aab023          	sd	a0,0(s5) # 1000 <kern_entry-0xffffffffc01ff000>
ffffffffc0201d9a:	862a                	mv	a2,a0
        assert(ptrs[i]);
ffffffffc0201d9c:	12050563          	beqz	a0,ffffffffc0201ec6 <slob_check+0x296>
        cprintf("[slob_test] Successfully allocated %lx bytes at address %p.\n", sizes[i]/2, ptrs[i]);
ffffffffc0201da0:	85a6                	mv	a1,s1
ffffffffc0201da2:	855a                	mv	a0,s6
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i += 2) {
ffffffffc0201da4:	0a41                	addi	s4,s4,16
        cprintf("[slob_test] Successfully allocated %lx bytes at address %p.\n", sizes[i]/2, ptrs[i]);
ffffffffc0201da6:	b0cfe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i += 2) {
ffffffffc0201daa:	0ac1                	addi	s5,s5,16
ffffffffc0201dac:	fd7a1fe3          	bne	s4,s7,ffffffffc0201d8a <slob_check+0x15a>
    }

    cprintf(">>>[slob_check]: Test case 5: Complete deallocation.<<<\n");
ffffffffc0201db0:	00002517          	auipc	a0,0x2
ffffffffc0201db4:	a3050513          	addi	a0,a0,-1488 # ffffffffc02037e0 <buddy_pmm_manager+0x7c0>
ffffffffc0201db8:	afafe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
ffffffffc0201dbc:	8aca                	mv	s5,s2
    // Test case 5: Complete deallocation
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
ffffffffc0201dbe:	4481                	li	s1,0
        if (ptrs[i]) {
            slob_free_bytes(ptrs[i], (i % 2 == 0) ? sizes[i]/2 : sizes[i]);
            cprintf("[slob_test] Successfully deallocated memory at address %p.\n", ptrs[i]);
ffffffffc0201dc0:	00002b97          	auipc	s7,0x2
ffffffffc0201dc4:	950b8b93          	addi	s7,s7,-1712 # ffffffffc0203710 <buddy_pmm_manager+0x6f0>
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
ffffffffc0201dc8:	4b25                	li	s6,9
        if (ptrs[i]) {
ffffffffc0201dca:	00043a03          	ld	s4,0(s0)
ffffffffc0201dce:	0004879b          	sext.w	a5,s1
ffffffffc0201dd2:	000a0e63          	beqz	s4,ffffffffc0201dee <slob_check+0x1be>
            slob_free_bytes(ptrs[i], (i % 2 == 0) ? sizes[i]/2 : sizes[i]);
ffffffffc0201dd6:	8b85                	andi	a5,a5,1
ffffffffc0201dd8:	000ab583          	ld	a1,0(s5)
ffffffffc0201ddc:	e391                	bnez	a5,ffffffffc0201de0 <slob_check+0x1b0>
ffffffffc0201dde:	8185                	srli	a1,a1,0x1
ffffffffc0201de0:	8552                	mv	a0,s4
ffffffffc0201de2:	ba7ff0ef          	jal	ra,ffffffffc0201988 <slob_free_bytes>
            cprintf("[slob_test] Successfully deallocated memory at address %p.\n", ptrs[i]);
ffffffffc0201de6:	85d2                	mv	a1,s4
ffffffffc0201de8:	855e                	mv	a0,s7
ffffffffc0201dea:	ac8fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
ffffffffc0201dee:	2485                	addiw	s1,s1,1
ffffffffc0201df0:	0421                	addi	s0,s0,8
ffffffffc0201df2:	0aa1                	addi	s5,s5,8
ffffffffc0201df4:	fd649be3          	bne	s1,s6,ffffffffc0201dca <slob_check+0x19a>
        }
    }

    cprintf(">>>[slob_check]: Test case 6: Allocate memory blocks larger than a page.<<<\n");
ffffffffc0201df8:	00002517          	auipc	a0,0x2
ffffffffc0201dfc:	a2850513          	addi	a0,a0,-1496 # ffffffffc0203820 <buddy_pmm_manager+0x800>
ffffffffc0201e00:	ab2fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    // Test case 6: Allocate memory blocks larger than a page
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
        size_t large_size = sizes[i] + PGSIZE;  // Sizes larger than a page
ffffffffc0201e04:	6b05                	lui	s6,0x1
        ptrs[i] = slob_alloc_bytes(large_size);
        assert(ptrs[i]);
        cprintf("[slob_test] Successfully allocated %lx bytes at address %p.\n", large_size, ptrs[i]);
ffffffffc0201e06:	00002a97          	auipc	s5,0x2
ffffffffc0201e0a:	892a8a93          	addi	s5,s5,-1902 # ffffffffc0203698 <buddy_pmm_manager+0x678>
        slob_free_bytes(ptrs[i], large_size);
        cprintf("[slob_test] Successfully deallocated memory at address %p.\n", ptrs[i]);
ffffffffc0201e0e:	00002a17          	auipc	s4,0x2
ffffffffc0201e12:	902a0a13          	addi	s4,s4,-1790 # ffffffffc0203710 <buddy_pmm_manager+0x6f0>
        size_t large_size = sizes[i] + PGSIZE;  // Sizes larger than a page
ffffffffc0201e16:	00093483          	ld	s1,0(s2)
ffffffffc0201e1a:	94da                	add	s1,s1,s6
        ptrs[i] = slob_alloc_bytes(large_size);
ffffffffc0201e1c:	8526                	mv	a0,s1
ffffffffc0201e1e:	883ff0ef          	jal	ra,ffffffffc02016a0 <slob_alloc_bytes>
ffffffffc0201e22:	842a                	mv	s0,a0
        assert(ptrs[i]);
ffffffffc0201e24:	c12d                	beqz	a0,ffffffffc0201e86 <slob_check+0x256>
        cprintf("[slob_test] Successfully allocated %lx bytes at address %p.\n", large_size, ptrs[i]);
ffffffffc0201e26:	862a                	mv	a2,a0
ffffffffc0201e28:	85a6                	mv	a1,s1
ffffffffc0201e2a:	8556                	mv	a0,s5
ffffffffc0201e2c:	a86fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
        slob_free_bytes(ptrs[i], large_size);
ffffffffc0201e30:	85a6                	mv	a1,s1
ffffffffc0201e32:	8522                	mv	a0,s0
ffffffffc0201e34:	b55ff0ef          	jal	ra,ffffffffc0201988 <slob_free_bytes>
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
ffffffffc0201e38:	0921                	addi	s2,s2,8
        cprintf("[slob_test] Successfully deallocated memory at address %p.\n", ptrs[i]);
ffffffffc0201e3a:	85a2                	mv	a1,s0
ffffffffc0201e3c:	8552                	mv	a0,s4
ffffffffc0201e3e:	a74fe0ef          	jal	ra,ffffffffc02000b2 <cprintf>
    for (int i = 0; i < sizeof(sizes)/sizeof(size_t); i++) {
ffffffffc0201e42:	fd391ae3          	bne	s2,s3,ffffffffc0201e16 <slob_check+0x1e6>
    }

    cprintf("[slob_check]: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
}
ffffffffc0201e46:	644e                	ld	s0,208(sp)
ffffffffc0201e48:	60ee                	ld	ra,216(sp)
ffffffffc0201e4a:	64ae                	ld	s1,200(sp)
ffffffffc0201e4c:	690e                	ld	s2,192(sp)
ffffffffc0201e4e:	79ea                	ld	s3,184(sp)
ffffffffc0201e50:	7a4a                	ld	s4,176(sp)
ffffffffc0201e52:	7aaa                	ld	s5,168(sp)
ffffffffc0201e54:	7b0a                	ld	s6,160(sp)
ffffffffc0201e56:	6bea                	ld	s7,152(sp)
    cprintf("[slob_check]: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
ffffffffc0201e58:	00002517          	auipc	a0,0x2
ffffffffc0201e5c:	a1850513          	addi	a0,a0,-1512 # ffffffffc0203870 <buddy_pmm_manager+0x850>
}
ffffffffc0201e60:	612d                	addi	sp,sp,224
    cprintf("[slob_check]: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
ffffffffc0201e62:	a50fe06f          	j	ffffffffc02000b2 <cprintf>
        assert(ptrs[i]);  // Assertion to check if allocation was successful
ffffffffc0201e66:	00002697          	auipc	a3,0x2
ffffffffc0201e6a:	82a68693          	addi	a3,a3,-2006 # ffffffffc0203690 <buddy_pmm_manager+0x670>
ffffffffc0201e6e:	00001617          	auipc	a2,0x1
ffffffffc0201e72:	d3a60613          	addi	a2,a2,-710 # ffffffffc0202ba8 <commands+0x510>
ffffffffc0201e76:	15c00593          	li	a1,348
ffffffffc0201e7a:	00001517          	auipc	a0,0x1
ffffffffc0201e7e:	4a650513          	addi	a0,a0,1190 # ffffffffc0203320 <buddy_pmm_manager+0x300>
ffffffffc0201e82:	d2afe0ef          	jal	ra,ffffffffc02003ac <__panic>
        assert(ptrs[i]);
ffffffffc0201e86:	00002697          	auipc	a3,0x2
ffffffffc0201e8a:	80a68693          	addi	a3,a3,-2038 # ffffffffc0203690 <buddy_pmm_manager+0x670>
ffffffffc0201e8e:	00001617          	auipc	a2,0x1
ffffffffc0201e92:	d1a60613          	addi	a2,a2,-742 # ffffffffc0202ba8 <commands+0x510>
ffffffffc0201e96:	18e00593          	li	a1,398
ffffffffc0201e9a:	00001517          	auipc	a0,0x1
ffffffffc0201e9e:	48650513          	addi	a0,a0,1158 # ffffffffc0203320 <buddy_pmm_manager+0x300>
ffffffffc0201ea2:	d0afe0ef          	jal	ra,ffffffffc02003ac <__panic>
        assert(ptrs[i]);
ffffffffc0201ea6:	00001697          	auipc	a3,0x1
ffffffffc0201eaa:	7ea68693          	addi	a3,a3,2026 # ffffffffc0203690 <buddy_pmm_manager+0x670>
ffffffffc0201eae:	00001617          	auipc	a2,0x1
ffffffffc0201eb2:	cfa60613          	addi	a2,a2,-774 # ffffffffc0202ba8 <commands+0x510>
ffffffffc0201eb6:	16b00593          	li	a1,363
ffffffffc0201eba:	00001517          	auipc	a0,0x1
ffffffffc0201ebe:	46650513          	addi	a0,a0,1126 # ffffffffc0203320 <buddy_pmm_manager+0x300>
ffffffffc0201ec2:	ceafe0ef          	jal	ra,ffffffffc02003ac <__panic>
        assert(ptrs[i]);
ffffffffc0201ec6:	00001697          	auipc	a3,0x1
ffffffffc0201eca:	7ca68693          	addi	a3,a3,1994 # ffffffffc0203690 <buddy_pmm_manager+0x670>
ffffffffc0201ece:	00001617          	auipc	a2,0x1
ffffffffc0201ed2:	cda60613          	addi	a2,a2,-806 # ffffffffc0202ba8 <commands+0x510>
ffffffffc0201ed6:	17c00593          	li	a1,380
ffffffffc0201eda:	00001517          	auipc	a0,0x1
ffffffffc0201ede:	44650513          	addi	a0,a0,1094 # ffffffffc0203320 <buddy_pmm_manager+0x300>
ffffffffc0201ee2:	ccafe0ef          	jal	ra,ffffffffc02003ac <__panic>

ffffffffc0201ee6 <printnum>:
 * */
static void
printnum(void (*putch)(int, void*), void *putdat,
        unsigned long long num, unsigned base, int width, int padc) {
    unsigned long long result = num;
    unsigned mod = do_div(result, base);
ffffffffc0201ee6:	02069813          	slli	a6,a3,0x20
        unsigned long long num, unsigned base, int width, int padc) {
ffffffffc0201eea:	7179                	addi	sp,sp,-48
    unsigned mod = do_div(result, base);
ffffffffc0201eec:	02085813          	srli	a6,a6,0x20
        unsigned long long num, unsigned base, int width, int padc) {
ffffffffc0201ef0:	e052                	sd	s4,0(sp)
    unsigned mod = do_div(result, base);
ffffffffc0201ef2:	03067a33          	remu	s4,a2,a6
        unsigned long long num, unsigned base, int width, int padc) {
ffffffffc0201ef6:	f022                	sd	s0,32(sp)
ffffffffc0201ef8:	ec26                	sd	s1,24(sp)
ffffffffc0201efa:	e84a                	sd	s2,16(sp)
ffffffffc0201efc:	f406                	sd	ra,40(sp)
ffffffffc0201efe:	e44e                	sd	s3,8(sp)
ffffffffc0201f00:	84aa                	mv	s1,a0
ffffffffc0201f02:	892e                	mv	s2,a1
    // first recursively print all preceding (more significant) digits
    if (num >= base) {
        printnum(putch, putdat, result, base, width - 1, padc);
    } else {
        // print any needed pad characters before first digit
        while (-- width > 0)
ffffffffc0201f04:	fff7041b          	addiw	s0,a4,-1
    unsigned mod = do_div(result, base);
ffffffffc0201f08:	2a01                	sext.w	s4,s4
    if (num >= base) {
ffffffffc0201f0a:	03067e63          	bgeu	a2,a6,ffffffffc0201f46 <printnum+0x60>
ffffffffc0201f0e:	89be                	mv	s3,a5
        while (-- width > 0)
ffffffffc0201f10:	00805763          	blez	s0,ffffffffc0201f1e <printnum+0x38>
ffffffffc0201f14:	347d                	addiw	s0,s0,-1
            putch(padc, putdat);
ffffffffc0201f16:	85ca                	mv	a1,s2
ffffffffc0201f18:	854e                	mv	a0,s3
ffffffffc0201f1a:	9482                	jalr	s1
        while (-- width > 0)
ffffffffc0201f1c:	fc65                	bnez	s0,ffffffffc0201f14 <printnum+0x2e>
    }
    // then print this (the least significant) digit
    putch("0123456789abcdef"[mod], putdat);
ffffffffc0201f1e:	1a02                	slli	s4,s4,0x20
ffffffffc0201f20:	00002797          	auipc	a5,0x2
ffffffffc0201f24:	a2878793          	addi	a5,a5,-1496 # ffffffffc0203948 <slob_pmm_manager+0x48>
ffffffffc0201f28:	020a5a13          	srli	s4,s4,0x20
ffffffffc0201f2c:	9a3e                	add	s4,s4,a5
}
ffffffffc0201f2e:	7402                	ld	s0,32(sp)
    putch("0123456789abcdef"[mod], putdat);
ffffffffc0201f30:	000a4503          	lbu	a0,0(s4)
}
ffffffffc0201f34:	70a2                	ld	ra,40(sp)
ffffffffc0201f36:	69a2                	ld	s3,8(sp)
ffffffffc0201f38:	6a02                	ld	s4,0(sp)
    putch("0123456789abcdef"[mod], putdat);
ffffffffc0201f3a:	85ca                	mv	a1,s2
ffffffffc0201f3c:	87a6                	mv	a5,s1
}
ffffffffc0201f3e:	6942                	ld	s2,16(sp)
ffffffffc0201f40:	64e2                	ld	s1,24(sp)
ffffffffc0201f42:	6145                	addi	sp,sp,48
    putch("0123456789abcdef"[mod], putdat);
ffffffffc0201f44:	8782                	jr	a5
        printnum(putch, putdat, result, base, width - 1, padc);
ffffffffc0201f46:	03065633          	divu	a2,a2,a6
ffffffffc0201f4a:	8722                	mv	a4,s0
ffffffffc0201f4c:	f9bff0ef          	jal	ra,ffffffffc0201ee6 <printnum>
ffffffffc0201f50:	b7f9                	j	ffffffffc0201f1e <printnum+0x38>

ffffffffc0201f52 <vprintfmt>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want printfmt() instead.
 * */
void
vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap) {
ffffffffc0201f52:	7119                	addi	sp,sp,-128
ffffffffc0201f54:	f4a6                	sd	s1,104(sp)
ffffffffc0201f56:	f0ca                	sd	s2,96(sp)
ffffffffc0201f58:	ecce                	sd	s3,88(sp)
ffffffffc0201f5a:	e8d2                	sd	s4,80(sp)
ffffffffc0201f5c:	e4d6                	sd	s5,72(sp)
ffffffffc0201f5e:	e0da                	sd	s6,64(sp)
ffffffffc0201f60:	fc5e                	sd	s7,56(sp)
ffffffffc0201f62:	f06a                	sd	s10,32(sp)
ffffffffc0201f64:	fc86                	sd	ra,120(sp)
ffffffffc0201f66:	f8a2                	sd	s0,112(sp)
ffffffffc0201f68:	f862                	sd	s8,48(sp)
ffffffffc0201f6a:	f466                	sd	s9,40(sp)
ffffffffc0201f6c:	ec6e                	sd	s11,24(sp)
ffffffffc0201f6e:	892a                	mv	s2,a0
ffffffffc0201f70:	84ae                	mv	s1,a1
ffffffffc0201f72:	8d32                	mv	s10,a2
ffffffffc0201f74:	8a36                	mv	s4,a3
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
ffffffffc0201f76:	02500993          	li	s3,37
            putch(ch, putdat);
        }

        // Process a %-escape sequence
        char padc = ' ';
        width = precision = -1;
ffffffffc0201f7a:	5b7d                	li	s6,-1
ffffffffc0201f7c:	00002a97          	auipc	s5,0x2
ffffffffc0201f80:	a00a8a93          	addi	s5,s5,-1536 # ffffffffc020397c <slob_pmm_manager+0x7c>
        case 'e':
            err = va_arg(ap, int);
            if (err < 0) {
                err = -err;
            }
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
ffffffffc0201f84:	00002b97          	auipc	s7,0x2
ffffffffc0201f88:	bd4b8b93          	addi	s7,s7,-1068 # ffffffffc0203b58 <error_string>
        while ((ch = *(unsigned char *)fmt ++) != '%') {
ffffffffc0201f8c:	000d4503          	lbu	a0,0(s10)
ffffffffc0201f90:	001d0413          	addi	s0,s10,1
ffffffffc0201f94:	01350a63          	beq	a0,s3,ffffffffc0201fa8 <vprintfmt+0x56>
            if (ch == '\0') {
ffffffffc0201f98:	c121                	beqz	a0,ffffffffc0201fd8 <vprintfmt+0x86>
            putch(ch, putdat);
ffffffffc0201f9a:	85a6                	mv	a1,s1
        while ((ch = *(unsigned char *)fmt ++) != '%') {
ffffffffc0201f9c:	0405                	addi	s0,s0,1
            putch(ch, putdat);
ffffffffc0201f9e:	9902                	jalr	s2
        while ((ch = *(unsigned char *)fmt ++) != '%') {
ffffffffc0201fa0:	fff44503          	lbu	a0,-1(s0)
ffffffffc0201fa4:	ff351ae3          	bne	a0,s3,ffffffffc0201f98 <vprintfmt+0x46>
        switch (ch = *(unsigned char *)fmt ++) {
ffffffffc0201fa8:	00044603          	lbu	a2,0(s0)
        char padc = ' ';
ffffffffc0201fac:	02000793          	li	a5,32
        lflag = altflag = 0;
ffffffffc0201fb0:	4c81                	li	s9,0
ffffffffc0201fb2:	4881                	li	a7,0
        width = precision = -1;
ffffffffc0201fb4:	5c7d                	li	s8,-1
ffffffffc0201fb6:	5dfd                	li	s11,-1
ffffffffc0201fb8:	05500513          	li	a0,85
                if (ch < '0' || ch > '9') {
ffffffffc0201fbc:	4825                	li	a6,9
        switch (ch = *(unsigned char *)fmt ++) {
ffffffffc0201fbe:	fdd6059b          	addiw	a1,a2,-35
ffffffffc0201fc2:	0ff5f593          	andi	a1,a1,255
ffffffffc0201fc6:	00140d13          	addi	s10,s0,1
ffffffffc0201fca:	04b56263          	bltu	a0,a1,ffffffffc020200e <vprintfmt+0xbc>
ffffffffc0201fce:	058a                	slli	a1,a1,0x2
ffffffffc0201fd0:	95d6                	add	a1,a1,s5
ffffffffc0201fd2:	4194                	lw	a3,0(a1)
ffffffffc0201fd4:	96d6                	add	a3,a3,s5
ffffffffc0201fd6:	8682                	jr	a3
            for (fmt --; fmt[-1] != '%'; fmt --)
                /* do nothing */;
            break;
        }
    }
}
ffffffffc0201fd8:	70e6                	ld	ra,120(sp)
ffffffffc0201fda:	7446                	ld	s0,112(sp)
ffffffffc0201fdc:	74a6                	ld	s1,104(sp)
ffffffffc0201fde:	7906                	ld	s2,96(sp)
ffffffffc0201fe0:	69e6                	ld	s3,88(sp)
ffffffffc0201fe2:	6a46                	ld	s4,80(sp)
ffffffffc0201fe4:	6aa6                	ld	s5,72(sp)
ffffffffc0201fe6:	6b06                	ld	s6,64(sp)
ffffffffc0201fe8:	7be2                	ld	s7,56(sp)
ffffffffc0201fea:	7c42                	ld	s8,48(sp)
ffffffffc0201fec:	7ca2                	ld	s9,40(sp)
ffffffffc0201fee:	7d02                	ld	s10,32(sp)
ffffffffc0201ff0:	6de2                	ld	s11,24(sp)
ffffffffc0201ff2:	6109                	addi	sp,sp,128
ffffffffc0201ff4:	8082                	ret
            padc = '0';
ffffffffc0201ff6:	87b2                	mv	a5,a2
            goto reswitch;
ffffffffc0201ff8:	00144603          	lbu	a2,1(s0)
        switch (ch = *(unsigned char *)fmt ++) {
ffffffffc0201ffc:	846a                	mv	s0,s10
ffffffffc0201ffe:	00140d13          	addi	s10,s0,1
ffffffffc0202002:	fdd6059b          	addiw	a1,a2,-35
ffffffffc0202006:	0ff5f593          	andi	a1,a1,255
ffffffffc020200a:	fcb572e3          	bgeu	a0,a1,ffffffffc0201fce <vprintfmt+0x7c>
            putch('%', putdat);
ffffffffc020200e:	85a6                	mv	a1,s1
ffffffffc0202010:	02500513          	li	a0,37
ffffffffc0202014:	9902                	jalr	s2
            for (fmt --; fmt[-1] != '%'; fmt --)
ffffffffc0202016:	fff44783          	lbu	a5,-1(s0)
ffffffffc020201a:	8d22                	mv	s10,s0
ffffffffc020201c:	f73788e3          	beq	a5,s3,ffffffffc0201f8c <vprintfmt+0x3a>
ffffffffc0202020:	ffed4783          	lbu	a5,-2(s10)
ffffffffc0202024:	1d7d                	addi	s10,s10,-1
ffffffffc0202026:	ff379de3          	bne	a5,s3,ffffffffc0202020 <vprintfmt+0xce>
ffffffffc020202a:	b78d                	j	ffffffffc0201f8c <vprintfmt+0x3a>
                precision = precision * 10 + ch - '0';
ffffffffc020202c:	fd060c1b          	addiw	s8,a2,-48
                ch = *fmt;
ffffffffc0202030:	00144603          	lbu	a2,1(s0)
        switch (ch = *(unsigned char *)fmt ++) {
ffffffffc0202034:	846a                	mv	s0,s10
                if (ch < '0' || ch > '9') {
ffffffffc0202036:	fd06069b          	addiw	a3,a2,-48
                ch = *fmt;
ffffffffc020203a:	0006059b          	sext.w	a1,a2
                if (ch < '0' || ch > '9') {
ffffffffc020203e:	02d86463          	bltu	a6,a3,ffffffffc0202066 <vprintfmt+0x114>
                ch = *fmt;
ffffffffc0202042:	00144603          	lbu	a2,1(s0)
                precision = precision * 10 + ch - '0';
ffffffffc0202046:	002c169b          	slliw	a3,s8,0x2
ffffffffc020204a:	0186873b          	addw	a4,a3,s8
ffffffffc020204e:	0017171b          	slliw	a4,a4,0x1
ffffffffc0202052:	9f2d                	addw	a4,a4,a1
                if (ch < '0' || ch > '9') {
ffffffffc0202054:	fd06069b          	addiw	a3,a2,-48
            for (precision = 0; ; ++ fmt) {
ffffffffc0202058:	0405                	addi	s0,s0,1
                precision = precision * 10 + ch - '0';
ffffffffc020205a:	fd070c1b          	addiw	s8,a4,-48
                ch = *fmt;
ffffffffc020205e:	0006059b          	sext.w	a1,a2
                if (ch < '0' || ch > '9') {
ffffffffc0202062:	fed870e3          	bgeu	a6,a3,ffffffffc0202042 <vprintfmt+0xf0>
            if (width < 0)
ffffffffc0202066:	f40ddce3          	bgez	s11,ffffffffc0201fbe <vprintfmt+0x6c>
                width = precision, precision = -1;
ffffffffc020206a:	8de2                	mv	s11,s8
ffffffffc020206c:	5c7d                	li	s8,-1
ffffffffc020206e:	bf81                	j	ffffffffc0201fbe <vprintfmt+0x6c>
            if (width < 0)
ffffffffc0202070:	fffdc693          	not	a3,s11
ffffffffc0202074:	96fd                	srai	a3,a3,0x3f
ffffffffc0202076:	00ddfdb3          	and	s11,s11,a3
        switch (ch = *(unsigned char *)fmt ++) {
ffffffffc020207a:	00144603          	lbu	a2,1(s0)
ffffffffc020207e:	2d81                	sext.w	s11,s11
ffffffffc0202080:	846a                	mv	s0,s10
            goto reswitch;
ffffffffc0202082:	bf35                	j	ffffffffc0201fbe <vprintfmt+0x6c>
            precision = va_arg(ap, int);
ffffffffc0202084:	000a2c03          	lw	s8,0(s4)
        switch (ch = *(unsigned char *)fmt ++) {
ffffffffc0202088:	00144603          	lbu	a2,1(s0)
            precision = va_arg(ap, int);
ffffffffc020208c:	0a21                	addi	s4,s4,8
        switch (ch = *(unsigned char *)fmt ++) {
ffffffffc020208e:	846a                	mv	s0,s10
            goto process_precision;
ffffffffc0202090:	bfd9                	j	ffffffffc0202066 <vprintfmt+0x114>
    if (lflag >= 2) {
ffffffffc0202092:	4705                	li	a4,1
            precision = va_arg(ap, int);
ffffffffc0202094:	008a0593          	addi	a1,s4,8
    if (lflag >= 2) {
ffffffffc0202098:	01174463          	blt	a4,a7,ffffffffc02020a0 <vprintfmt+0x14e>
    else if (lflag) {
ffffffffc020209c:	1a088e63          	beqz	a7,ffffffffc0202258 <vprintfmt+0x306>
        return va_arg(*ap, unsigned long);
ffffffffc02020a0:	000a3603          	ld	a2,0(s4)
ffffffffc02020a4:	46c1                	li	a3,16
ffffffffc02020a6:	8a2e                	mv	s4,a1
            printnum(putch, putdat, num, base, width, padc);
ffffffffc02020a8:	2781                	sext.w	a5,a5
ffffffffc02020aa:	876e                	mv	a4,s11
ffffffffc02020ac:	85a6                	mv	a1,s1
ffffffffc02020ae:	854a                	mv	a0,s2
ffffffffc02020b0:	e37ff0ef          	jal	ra,ffffffffc0201ee6 <printnum>
            break;
ffffffffc02020b4:	bde1                	j	ffffffffc0201f8c <vprintfmt+0x3a>
            putch(va_arg(ap, int), putdat);
ffffffffc02020b6:	000a2503          	lw	a0,0(s4)
ffffffffc02020ba:	85a6                	mv	a1,s1
ffffffffc02020bc:	0a21                	addi	s4,s4,8
ffffffffc02020be:	9902                	jalr	s2
            break;
ffffffffc02020c0:	b5f1                	j	ffffffffc0201f8c <vprintfmt+0x3a>
    if (lflag >= 2) {
ffffffffc02020c2:	4705                	li	a4,1
            precision = va_arg(ap, int);
ffffffffc02020c4:	008a0593          	addi	a1,s4,8
    if (lflag >= 2) {
ffffffffc02020c8:	01174463          	blt	a4,a7,ffffffffc02020d0 <vprintfmt+0x17e>
    else if (lflag) {
ffffffffc02020cc:	18088163          	beqz	a7,ffffffffc020224e <vprintfmt+0x2fc>
        return va_arg(*ap, unsigned long);
ffffffffc02020d0:	000a3603          	ld	a2,0(s4)
ffffffffc02020d4:	46a9                	li	a3,10
ffffffffc02020d6:	8a2e                	mv	s4,a1
ffffffffc02020d8:	bfc1                	j	ffffffffc02020a8 <vprintfmt+0x156>
        switch (ch = *(unsigned char *)fmt ++) {
ffffffffc02020da:	00144603          	lbu	a2,1(s0)
            altflag = 1;
ffffffffc02020de:	4c85                	li	s9,1
        switch (ch = *(unsigned char *)fmt ++) {
ffffffffc02020e0:	846a                	mv	s0,s10
            goto reswitch;
ffffffffc02020e2:	bdf1                	j	ffffffffc0201fbe <vprintfmt+0x6c>
            putch(ch, putdat);
ffffffffc02020e4:	85a6                	mv	a1,s1
ffffffffc02020e6:	02500513          	li	a0,37
ffffffffc02020ea:	9902                	jalr	s2
            break;
ffffffffc02020ec:	b545                	j	ffffffffc0201f8c <vprintfmt+0x3a>
        switch (ch = *(unsigned char *)fmt ++) {
ffffffffc02020ee:	00144603          	lbu	a2,1(s0)
            lflag ++;
ffffffffc02020f2:	2885                	addiw	a7,a7,1
        switch (ch = *(unsigned char *)fmt ++) {
ffffffffc02020f4:	846a                	mv	s0,s10
            goto reswitch;
ffffffffc02020f6:	b5e1                	j	ffffffffc0201fbe <vprintfmt+0x6c>
    if (lflag >= 2) {
ffffffffc02020f8:	4705                	li	a4,1
            precision = va_arg(ap, int);
ffffffffc02020fa:	008a0593          	addi	a1,s4,8
    if (lflag >= 2) {
ffffffffc02020fe:	01174463          	blt	a4,a7,ffffffffc0202106 <vprintfmt+0x1b4>
    else if (lflag) {
ffffffffc0202102:	14088163          	beqz	a7,ffffffffc0202244 <vprintfmt+0x2f2>
        return va_arg(*ap, unsigned long);
ffffffffc0202106:	000a3603          	ld	a2,0(s4)
ffffffffc020210a:	46a1                	li	a3,8
ffffffffc020210c:	8a2e                	mv	s4,a1
ffffffffc020210e:	bf69                	j	ffffffffc02020a8 <vprintfmt+0x156>
            putch('0', putdat);
ffffffffc0202110:	03000513          	li	a0,48
ffffffffc0202114:	85a6                	mv	a1,s1
ffffffffc0202116:	e03e                	sd	a5,0(sp)
ffffffffc0202118:	9902                	jalr	s2
            putch('x', putdat);
ffffffffc020211a:	85a6                	mv	a1,s1
ffffffffc020211c:	07800513          	li	a0,120
ffffffffc0202120:	9902                	jalr	s2
            num = (unsigned long long)(uintptr_t)va_arg(ap, void *);
ffffffffc0202122:	0a21                	addi	s4,s4,8
            goto number;
ffffffffc0202124:	6782                	ld	a5,0(sp)
ffffffffc0202126:	46c1                	li	a3,16
            num = (unsigned long long)(uintptr_t)va_arg(ap, void *);
ffffffffc0202128:	ff8a3603          	ld	a2,-8(s4)
            goto number;
ffffffffc020212c:	bfb5                	j	ffffffffc02020a8 <vprintfmt+0x156>
            if ((p = va_arg(ap, char *)) == NULL) {
ffffffffc020212e:	000a3403          	ld	s0,0(s4)
ffffffffc0202132:	008a0713          	addi	a4,s4,8
ffffffffc0202136:	e03a                	sd	a4,0(sp)
ffffffffc0202138:	14040263          	beqz	s0,ffffffffc020227c <vprintfmt+0x32a>
            if (width > 0 && padc != '-') {
ffffffffc020213c:	0fb05763          	blez	s11,ffffffffc020222a <vprintfmt+0x2d8>
ffffffffc0202140:	02d00693          	li	a3,45
ffffffffc0202144:	0cd79163          	bne	a5,a3,ffffffffc0202206 <vprintfmt+0x2b4>
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
ffffffffc0202148:	00044783          	lbu	a5,0(s0)
ffffffffc020214c:	0007851b          	sext.w	a0,a5
ffffffffc0202150:	cf85                	beqz	a5,ffffffffc0202188 <vprintfmt+0x236>
ffffffffc0202152:	00140a13          	addi	s4,s0,1
                if (altflag && (ch < ' ' || ch > '~')) {
ffffffffc0202156:	05e00413          	li	s0,94
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
ffffffffc020215a:	000c4563          	bltz	s8,ffffffffc0202164 <vprintfmt+0x212>
ffffffffc020215e:	3c7d                	addiw	s8,s8,-1
ffffffffc0202160:	036c0263          	beq	s8,s6,ffffffffc0202184 <vprintfmt+0x232>
                    putch('?', putdat);
ffffffffc0202164:	85a6                	mv	a1,s1
                if (altflag && (ch < ' ' || ch > '~')) {
ffffffffc0202166:	0e0c8e63          	beqz	s9,ffffffffc0202262 <vprintfmt+0x310>
ffffffffc020216a:	3781                	addiw	a5,a5,-32
ffffffffc020216c:	0ef47b63          	bgeu	s0,a5,ffffffffc0202262 <vprintfmt+0x310>
                    putch('?', putdat);
ffffffffc0202170:	03f00513          	li	a0,63
ffffffffc0202174:	9902                	jalr	s2
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
ffffffffc0202176:	000a4783          	lbu	a5,0(s4)
ffffffffc020217a:	3dfd                	addiw	s11,s11,-1
ffffffffc020217c:	0a05                	addi	s4,s4,1
ffffffffc020217e:	0007851b          	sext.w	a0,a5
ffffffffc0202182:	ffe1                	bnez	a5,ffffffffc020215a <vprintfmt+0x208>
            for (; width > 0; width --) {
ffffffffc0202184:	01b05963          	blez	s11,ffffffffc0202196 <vprintfmt+0x244>
ffffffffc0202188:	3dfd                	addiw	s11,s11,-1
                putch(' ', putdat);
ffffffffc020218a:	85a6                	mv	a1,s1
ffffffffc020218c:	02000513          	li	a0,32
ffffffffc0202190:	9902                	jalr	s2
            for (; width > 0; width --) {
ffffffffc0202192:	fe0d9be3          	bnez	s11,ffffffffc0202188 <vprintfmt+0x236>
            if ((p = va_arg(ap, char *)) == NULL) {
ffffffffc0202196:	6a02                	ld	s4,0(sp)
ffffffffc0202198:	bbd5                	j	ffffffffc0201f8c <vprintfmt+0x3a>
    if (lflag >= 2) {
ffffffffc020219a:	4705                	li	a4,1
            precision = va_arg(ap, int);
ffffffffc020219c:	008a0c93          	addi	s9,s4,8
    if (lflag >= 2) {
ffffffffc02021a0:	01174463          	blt	a4,a7,ffffffffc02021a8 <vprintfmt+0x256>
    else if (lflag) {
ffffffffc02021a4:	08088d63          	beqz	a7,ffffffffc020223e <vprintfmt+0x2ec>
        return va_arg(*ap, long);
ffffffffc02021a8:	000a3403          	ld	s0,0(s4)
            if ((long long)num < 0) {
ffffffffc02021ac:	0a044d63          	bltz	s0,ffffffffc0202266 <vprintfmt+0x314>
            num = getint(&ap, lflag);
ffffffffc02021b0:	8622                	mv	a2,s0
ffffffffc02021b2:	8a66                	mv	s4,s9
ffffffffc02021b4:	46a9                	li	a3,10
ffffffffc02021b6:	bdcd                	j	ffffffffc02020a8 <vprintfmt+0x156>
            err = va_arg(ap, int);
ffffffffc02021b8:	000a2783          	lw	a5,0(s4)
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
ffffffffc02021bc:	4719                	li	a4,6
            err = va_arg(ap, int);
ffffffffc02021be:	0a21                	addi	s4,s4,8
            if (err < 0) {
ffffffffc02021c0:	41f7d69b          	sraiw	a3,a5,0x1f
ffffffffc02021c4:	8fb5                	xor	a5,a5,a3
ffffffffc02021c6:	40d786bb          	subw	a3,a5,a3
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
ffffffffc02021ca:	02d74163          	blt	a4,a3,ffffffffc02021ec <vprintfmt+0x29a>
ffffffffc02021ce:	00369793          	slli	a5,a3,0x3
ffffffffc02021d2:	97de                	add	a5,a5,s7
ffffffffc02021d4:	639c                	ld	a5,0(a5)
ffffffffc02021d6:	cb99                	beqz	a5,ffffffffc02021ec <vprintfmt+0x29a>
                printfmt(putch, putdat, "%s", p);
ffffffffc02021d8:	86be                	mv	a3,a5
ffffffffc02021da:	00001617          	auipc	a2,0x1
ffffffffc02021de:	79e60613          	addi	a2,a2,1950 # ffffffffc0203978 <slob_pmm_manager+0x78>
ffffffffc02021e2:	85a6                	mv	a1,s1
ffffffffc02021e4:	854a                	mv	a0,s2
ffffffffc02021e6:	0ce000ef          	jal	ra,ffffffffc02022b4 <printfmt>
ffffffffc02021ea:	b34d                	j	ffffffffc0201f8c <vprintfmt+0x3a>
                printfmt(putch, putdat, "error %d", err);
ffffffffc02021ec:	00001617          	auipc	a2,0x1
ffffffffc02021f0:	77c60613          	addi	a2,a2,1916 # ffffffffc0203968 <slob_pmm_manager+0x68>
ffffffffc02021f4:	85a6                	mv	a1,s1
ffffffffc02021f6:	854a                	mv	a0,s2
ffffffffc02021f8:	0bc000ef          	jal	ra,ffffffffc02022b4 <printfmt>
ffffffffc02021fc:	bb41                	j	ffffffffc0201f8c <vprintfmt+0x3a>
                p = "(null)";
ffffffffc02021fe:	00001417          	auipc	s0,0x1
ffffffffc0202202:	76240413          	addi	s0,s0,1890 # ffffffffc0203960 <slob_pmm_manager+0x60>
                for (width -= strnlen(p, precision); width > 0; width --) {
ffffffffc0202206:	85e2                	mv	a1,s8
ffffffffc0202208:	8522                	mv	a0,s0
ffffffffc020220a:	e43e                	sd	a5,8(sp)
ffffffffc020220c:	1cc000ef          	jal	ra,ffffffffc02023d8 <strnlen>
ffffffffc0202210:	40ad8dbb          	subw	s11,s11,a0
ffffffffc0202214:	01b05b63          	blez	s11,ffffffffc020222a <vprintfmt+0x2d8>
                    putch(padc, putdat);
ffffffffc0202218:	67a2                	ld	a5,8(sp)
ffffffffc020221a:	00078a1b          	sext.w	s4,a5
                for (width -= strnlen(p, precision); width > 0; width --) {
ffffffffc020221e:	3dfd                	addiw	s11,s11,-1
                    putch(padc, putdat);
ffffffffc0202220:	85a6                	mv	a1,s1
ffffffffc0202222:	8552                	mv	a0,s4
ffffffffc0202224:	9902                	jalr	s2
                for (width -= strnlen(p, precision); width > 0; width --) {
ffffffffc0202226:	fe0d9ce3          	bnez	s11,ffffffffc020221e <vprintfmt+0x2cc>
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
ffffffffc020222a:	00044783          	lbu	a5,0(s0)
ffffffffc020222e:	00140a13          	addi	s4,s0,1
ffffffffc0202232:	0007851b          	sext.w	a0,a5
ffffffffc0202236:	d3a5                	beqz	a5,ffffffffc0202196 <vprintfmt+0x244>
                if (altflag && (ch < ' ' || ch > '~')) {
ffffffffc0202238:	05e00413          	li	s0,94
ffffffffc020223c:	bf39                	j	ffffffffc020215a <vprintfmt+0x208>
        return va_arg(*ap, int);
ffffffffc020223e:	000a2403          	lw	s0,0(s4)
ffffffffc0202242:	b7ad                	j	ffffffffc02021ac <vprintfmt+0x25a>
        return va_arg(*ap, unsigned int);
ffffffffc0202244:	000a6603          	lwu	a2,0(s4)
ffffffffc0202248:	46a1                	li	a3,8
ffffffffc020224a:	8a2e                	mv	s4,a1
ffffffffc020224c:	bdb1                	j	ffffffffc02020a8 <vprintfmt+0x156>
ffffffffc020224e:	000a6603          	lwu	a2,0(s4)
ffffffffc0202252:	46a9                	li	a3,10
ffffffffc0202254:	8a2e                	mv	s4,a1
ffffffffc0202256:	bd89                	j	ffffffffc02020a8 <vprintfmt+0x156>
ffffffffc0202258:	000a6603          	lwu	a2,0(s4)
ffffffffc020225c:	46c1                	li	a3,16
ffffffffc020225e:	8a2e                	mv	s4,a1
ffffffffc0202260:	b5a1                	j	ffffffffc02020a8 <vprintfmt+0x156>
                    putch(ch, putdat);
ffffffffc0202262:	9902                	jalr	s2
ffffffffc0202264:	bf09                	j	ffffffffc0202176 <vprintfmt+0x224>
                putch('-', putdat);
ffffffffc0202266:	85a6                	mv	a1,s1
ffffffffc0202268:	02d00513          	li	a0,45
ffffffffc020226c:	e03e                	sd	a5,0(sp)
ffffffffc020226e:	9902                	jalr	s2
                num = -(long long)num;
ffffffffc0202270:	6782                	ld	a5,0(sp)
ffffffffc0202272:	8a66                	mv	s4,s9
ffffffffc0202274:	40800633          	neg	a2,s0
ffffffffc0202278:	46a9                	li	a3,10
ffffffffc020227a:	b53d                	j	ffffffffc02020a8 <vprintfmt+0x156>
            if (width > 0 && padc != '-') {
ffffffffc020227c:	03b05163          	blez	s11,ffffffffc020229e <vprintfmt+0x34c>
ffffffffc0202280:	02d00693          	li	a3,45
ffffffffc0202284:	f6d79de3          	bne	a5,a3,ffffffffc02021fe <vprintfmt+0x2ac>
                p = "(null)";
ffffffffc0202288:	00001417          	auipc	s0,0x1
ffffffffc020228c:	6d840413          	addi	s0,s0,1752 # ffffffffc0203960 <slob_pmm_manager+0x60>
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
ffffffffc0202290:	02800793          	li	a5,40
ffffffffc0202294:	02800513          	li	a0,40
ffffffffc0202298:	00140a13          	addi	s4,s0,1
ffffffffc020229c:	bd6d                	j	ffffffffc0202156 <vprintfmt+0x204>
ffffffffc020229e:	00001a17          	auipc	s4,0x1
ffffffffc02022a2:	6c3a0a13          	addi	s4,s4,1731 # ffffffffc0203961 <slob_pmm_manager+0x61>
ffffffffc02022a6:	02800513          	li	a0,40
ffffffffc02022aa:	02800793          	li	a5,40
                if (altflag && (ch < ' ' || ch > '~')) {
ffffffffc02022ae:	05e00413          	li	s0,94
ffffffffc02022b2:	b565                	j	ffffffffc020215a <vprintfmt+0x208>

ffffffffc02022b4 <printfmt>:
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...) {
ffffffffc02022b4:	715d                	addi	sp,sp,-80
    va_start(ap, fmt);
ffffffffc02022b6:	02810313          	addi	t1,sp,40
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...) {
ffffffffc02022ba:	f436                	sd	a3,40(sp)
    vprintfmt(putch, putdat, fmt, ap);
ffffffffc02022bc:	869a                	mv	a3,t1
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...) {
ffffffffc02022be:	ec06                	sd	ra,24(sp)
ffffffffc02022c0:	f83a                	sd	a4,48(sp)
ffffffffc02022c2:	fc3e                	sd	a5,56(sp)
ffffffffc02022c4:	e0c2                	sd	a6,64(sp)
ffffffffc02022c6:	e4c6                	sd	a7,72(sp)
    va_start(ap, fmt);
ffffffffc02022c8:	e41a                	sd	t1,8(sp)
    vprintfmt(putch, putdat, fmt, ap);
ffffffffc02022ca:	c89ff0ef          	jal	ra,ffffffffc0201f52 <vprintfmt>
}
ffffffffc02022ce:	60e2                	ld	ra,24(sp)
ffffffffc02022d0:	6161                	addi	sp,sp,80
ffffffffc02022d2:	8082                	ret

ffffffffc02022d4 <readline>:
 * The readline() function returns the text of the line read. If some errors
 * are happened, NULL is returned. The return value is a global variable,
 * thus it should be copied before it is used.
 * */
char *
readline(const char *prompt) {
ffffffffc02022d4:	715d                	addi	sp,sp,-80
ffffffffc02022d6:	e486                	sd	ra,72(sp)
ffffffffc02022d8:	e0a6                	sd	s1,64(sp)
ffffffffc02022da:	fc4a                	sd	s2,56(sp)
ffffffffc02022dc:	f84e                	sd	s3,48(sp)
ffffffffc02022de:	f452                	sd	s4,40(sp)
ffffffffc02022e0:	f056                	sd	s5,32(sp)
ffffffffc02022e2:	ec5a                	sd	s6,24(sp)
ffffffffc02022e4:	e85e                	sd	s7,16(sp)
    if (prompt != NULL) {
ffffffffc02022e6:	c901                	beqz	a0,ffffffffc02022f6 <readline+0x22>
ffffffffc02022e8:	85aa                	mv	a1,a0
        cprintf("%s", prompt);
ffffffffc02022ea:	00001517          	auipc	a0,0x1
ffffffffc02022ee:	68e50513          	addi	a0,a0,1678 # ffffffffc0203978 <slob_pmm_manager+0x78>
ffffffffc02022f2:	dc1fd0ef          	jal	ra,ffffffffc02000b2 <cprintf>
readline(const char *prompt) {
ffffffffc02022f6:	4481                	li	s1,0
    while (1) {
        c = getchar();
        if (c < 0) {
            return NULL;
        }
        else if (c >= ' ' && i < BUFSIZE - 1) {
ffffffffc02022f8:	497d                	li	s2,31
            cputchar(c);
            buf[i ++] = c;
        }
        else if (c == '\b' && i > 0) {
ffffffffc02022fa:	49a1                	li	s3,8
            cputchar(c);
            i --;
        }
        else if (c == '\n' || c == '\r') {
ffffffffc02022fc:	4aa9                	li	s5,10
ffffffffc02022fe:	4b35                	li	s6,13
            buf[i ++] = c;
ffffffffc0202300:	00005b97          	auipc	s7,0x5
ffffffffc0202304:	e68b8b93          	addi	s7,s7,-408 # ffffffffc0207168 <buf>
        else if (c >= ' ' && i < BUFSIZE - 1) {
ffffffffc0202308:	3fe00a13          	li	s4,1022
        c = getchar();
ffffffffc020230c:	e1ffd0ef          	jal	ra,ffffffffc020012a <getchar>
        if (c < 0) {
ffffffffc0202310:	00054a63          	bltz	a0,ffffffffc0202324 <readline+0x50>
        else if (c >= ' ' && i < BUFSIZE - 1) {
ffffffffc0202314:	00a95a63          	bge	s2,a0,ffffffffc0202328 <readline+0x54>
ffffffffc0202318:	029a5263          	bge	s4,s1,ffffffffc020233c <readline+0x68>
        c = getchar();
ffffffffc020231c:	e0ffd0ef          	jal	ra,ffffffffc020012a <getchar>
        if (c < 0) {
ffffffffc0202320:	fe055ae3          	bgez	a0,ffffffffc0202314 <readline+0x40>
            return NULL;
ffffffffc0202324:	4501                	li	a0,0
ffffffffc0202326:	a091                	j	ffffffffc020236a <readline+0x96>
        else if (c == '\b' && i > 0) {
ffffffffc0202328:	03351463          	bne	a0,s3,ffffffffc0202350 <readline+0x7c>
ffffffffc020232c:	e8a9                	bnez	s1,ffffffffc020237e <readline+0xaa>
        c = getchar();
ffffffffc020232e:	dfdfd0ef          	jal	ra,ffffffffc020012a <getchar>
        if (c < 0) {
ffffffffc0202332:	fe0549e3          	bltz	a0,ffffffffc0202324 <readline+0x50>
        else if (c >= ' ' && i < BUFSIZE - 1) {
ffffffffc0202336:	fea959e3          	bge	s2,a0,ffffffffc0202328 <readline+0x54>
ffffffffc020233a:	4481                	li	s1,0
            cputchar(c);
ffffffffc020233c:	e42a                	sd	a0,8(sp)
ffffffffc020233e:	dabfd0ef          	jal	ra,ffffffffc02000e8 <cputchar>
            buf[i ++] = c;
ffffffffc0202342:	6522                	ld	a0,8(sp)
ffffffffc0202344:	009b87b3          	add	a5,s7,s1
ffffffffc0202348:	2485                	addiw	s1,s1,1
ffffffffc020234a:	00a78023          	sb	a0,0(a5)
ffffffffc020234e:	bf7d                	j	ffffffffc020230c <readline+0x38>
        else if (c == '\n' || c == '\r') {
ffffffffc0202350:	01550463          	beq	a0,s5,ffffffffc0202358 <readline+0x84>
ffffffffc0202354:	fb651ce3          	bne	a0,s6,ffffffffc020230c <readline+0x38>
            cputchar(c);
ffffffffc0202358:	d91fd0ef          	jal	ra,ffffffffc02000e8 <cputchar>
            buf[i] = '\0';
ffffffffc020235c:	00005517          	auipc	a0,0x5
ffffffffc0202360:	e0c50513          	addi	a0,a0,-500 # ffffffffc0207168 <buf>
ffffffffc0202364:	94aa                	add	s1,s1,a0
ffffffffc0202366:	00048023          	sb	zero,0(s1)
            return buf;
        }
    }
}
ffffffffc020236a:	60a6                	ld	ra,72(sp)
ffffffffc020236c:	6486                	ld	s1,64(sp)
ffffffffc020236e:	7962                	ld	s2,56(sp)
ffffffffc0202370:	79c2                	ld	s3,48(sp)
ffffffffc0202372:	7a22                	ld	s4,40(sp)
ffffffffc0202374:	7a82                	ld	s5,32(sp)
ffffffffc0202376:	6b62                	ld	s6,24(sp)
ffffffffc0202378:	6bc2                	ld	s7,16(sp)
ffffffffc020237a:	6161                	addi	sp,sp,80
ffffffffc020237c:	8082                	ret
            cputchar(c);
ffffffffc020237e:	4521                	li	a0,8
ffffffffc0202380:	d69fd0ef          	jal	ra,ffffffffc02000e8 <cputchar>
            i --;
ffffffffc0202384:	34fd                	addiw	s1,s1,-1
ffffffffc0202386:	b759                	j	ffffffffc020230c <readline+0x38>

ffffffffc0202388 <sbi_console_putchar>:
uint64_t SBI_REMOTE_SFENCE_VMA_ASID = 7;
uint64_t SBI_SHUTDOWN = 8;

uint64_t sbi_call(uint64_t sbi_type, uint64_t arg0, uint64_t arg1, uint64_t arg2) {
    uint64_t ret_val;
    __asm__ volatile (
ffffffffc0202388:	4781                	li	a5,0
ffffffffc020238a:	00005717          	auipc	a4,0x5
ffffffffc020238e:	c7e73703          	ld	a4,-898(a4) # ffffffffc0207008 <SBI_CONSOLE_PUTCHAR>
ffffffffc0202392:	88ba                	mv	a7,a4
ffffffffc0202394:	852a                	mv	a0,a0
ffffffffc0202396:	85be                	mv	a1,a5
ffffffffc0202398:	863e                	mv	a2,a5
ffffffffc020239a:	00000073          	ecall
ffffffffc020239e:	87aa                	mv	a5,a0
    return ret_val;
}

void sbi_console_putchar(unsigned char ch) {
    sbi_call(SBI_CONSOLE_PUTCHAR, ch, 0, 0);
}
ffffffffc02023a0:	8082                	ret

ffffffffc02023a2 <sbi_set_timer>:
    __asm__ volatile (
ffffffffc02023a2:	4781                	li	a5,0
ffffffffc02023a4:	00005717          	auipc	a4,0x5
ffffffffc02023a8:	20473703          	ld	a4,516(a4) # ffffffffc02075a8 <SBI_SET_TIMER>
ffffffffc02023ac:	88ba                	mv	a7,a4
ffffffffc02023ae:	852a                	mv	a0,a0
ffffffffc02023b0:	85be                	mv	a1,a5
ffffffffc02023b2:	863e                	mv	a2,a5
ffffffffc02023b4:	00000073          	ecall
ffffffffc02023b8:	87aa                	mv	a5,a0

void sbi_set_timer(unsigned long long stime_value) {
    sbi_call(SBI_SET_TIMER, stime_value, 0, 0);
}
ffffffffc02023ba:	8082                	ret

ffffffffc02023bc <sbi_console_getchar>:
    __asm__ volatile (
ffffffffc02023bc:	4501                	li	a0,0
ffffffffc02023be:	00005797          	auipc	a5,0x5
ffffffffc02023c2:	c427b783          	ld	a5,-958(a5) # ffffffffc0207000 <SBI_CONSOLE_GETCHAR>
ffffffffc02023c6:	88be                	mv	a7,a5
ffffffffc02023c8:	852a                	mv	a0,a0
ffffffffc02023ca:	85aa                	mv	a1,a0
ffffffffc02023cc:	862a                	mv	a2,a0
ffffffffc02023ce:	00000073          	ecall
ffffffffc02023d2:	852a                	mv	a0,a0

int sbi_console_getchar(void) {
    return sbi_call(SBI_CONSOLE_GETCHAR, 0, 0, 0);
ffffffffc02023d4:	2501                	sext.w	a0,a0
ffffffffc02023d6:	8082                	ret

ffffffffc02023d8 <strnlen>:
 * @len if there is no '\0' character among the first @len characters
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
    size_t cnt = 0;
ffffffffc02023d8:	4781                	li	a5,0
    while (cnt < len && *s ++ != '\0') {
ffffffffc02023da:	e589                	bnez	a1,ffffffffc02023e4 <strnlen+0xc>
ffffffffc02023dc:	a811                	j	ffffffffc02023f0 <strnlen+0x18>
        cnt ++;
ffffffffc02023de:	0785                	addi	a5,a5,1
    while (cnt < len && *s ++ != '\0') {
ffffffffc02023e0:	00f58863          	beq	a1,a5,ffffffffc02023f0 <strnlen+0x18>
ffffffffc02023e4:	00f50733          	add	a4,a0,a5
ffffffffc02023e8:	00074703          	lbu	a4,0(a4)
ffffffffc02023ec:	fb6d                	bnez	a4,ffffffffc02023de <strnlen+0x6>
ffffffffc02023ee:	85be                	mv	a1,a5
    }
    return cnt;
}
ffffffffc02023f0:	852e                	mv	a0,a1
ffffffffc02023f2:	8082                	ret

ffffffffc02023f4 <strcmp>:
int
strcmp(const char *s1, const char *s2) {
#ifdef __HAVE_ARCH_STRCMP
    return __strcmp(s1, s2);
#else
    while (*s1 != '\0' && *s1 == *s2) {
ffffffffc02023f4:	00054783          	lbu	a5,0(a0)
        s1 ++, s2 ++;
    }
    return (int)((unsigned char)*s1 - (unsigned char)*s2);
ffffffffc02023f8:	0005c703          	lbu	a4,0(a1)
    while (*s1 != '\0' && *s1 == *s2) {
ffffffffc02023fc:	cb89                	beqz	a5,ffffffffc020240e <strcmp+0x1a>
        s1 ++, s2 ++;
ffffffffc02023fe:	0505                	addi	a0,a0,1
ffffffffc0202400:	0585                	addi	a1,a1,1
    while (*s1 != '\0' && *s1 == *s2) {
ffffffffc0202402:	fee789e3          	beq	a5,a4,ffffffffc02023f4 <strcmp>
    return (int)((unsigned char)*s1 - (unsigned char)*s2);
ffffffffc0202406:	0007851b          	sext.w	a0,a5
#endif /* __HAVE_ARCH_STRCMP */
}
ffffffffc020240a:	9d19                	subw	a0,a0,a4
ffffffffc020240c:	8082                	ret
ffffffffc020240e:	4501                	li	a0,0
ffffffffc0202410:	bfed                	j	ffffffffc020240a <strcmp+0x16>

ffffffffc0202412 <strchr>:
 * The strchr() function returns a pointer to the first occurrence of
 * character in @s. If the value is not found, the function returns 'NULL'.
 * */
char *
strchr(const char *s, char c) {
    while (*s != '\0') {
ffffffffc0202412:	00054783          	lbu	a5,0(a0)
ffffffffc0202416:	c799                	beqz	a5,ffffffffc0202424 <strchr+0x12>
        if (*s == c) {
ffffffffc0202418:	00f58763          	beq	a1,a5,ffffffffc0202426 <strchr+0x14>
    while (*s != '\0') {
ffffffffc020241c:	00154783          	lbu	a5,1(a0)
            return (char *)s;
        }
        s ++;
ffffffffc0202420:	0505                	addi	a0,a0,1
    while (*s != '\0') {
ffffffffc0202422:	fbfd                	bnez	a5,ffffffffc0202418 <strchr+0x6>
    }
    return NULL;
ffffffffc0202424:	4501                	li	a0,0
}
ffffffffc0202426:	8082                	ret

ffffffffc0202428 <memset>:
memset(void *s, char c, size_t n) {
#ifdef __HAVE_ARCH_MEMSET
    return __memset(s, c, n);
#else
    char *p = s;
    while (n -- > 0) {
ffffffffc0202428:	ca01                	beqz	a2,ffffffffc0202438 <memset+0x10>
ffffffffc020242a:	962a                	add	a2,a2,a0
    char *p = s;
ffffffffc020242c:	87aa                	mv	a5,a0
        *p ++ = c;
ffffffffc020242e:	0785                	addi	a5,a5,1
ffffffffc0202430:	feb78fa3          	sb	a1,-1(a5)
    while (n -- > 0) {
ffffffffc0202434:	fec79de3          	bne	a5,a2,ffffffffc020242e <memset+0x6>
    }
    return s;
#endif /* __HAVE_ARCH_MEMSET */
}
ffffffffc0202438:	8082                	ret
